home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_libtool.idb / usr / freeware / share / libtool / ltmain.sh.z / ltmain.sh
Encoding:
Text File  |  1999-07-16  |  105.0 KB  |  3,897 lines

  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun ltconfig.
  3. #
  4. # Copyright (C) 1996-1999 Free Software Foundation, Inc.
  5. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25.  
  26. # Check that we have a working $echo.
  27. if test "X$1" = X--no-reexec; then
  28.   # Discard the --no-reexec flag, and continue.
  29.   shift
  30. elif test "X$1" = X--fallback-echo; then
  31.   # Avoid inline document here, it may be left over
  32.   :
  33. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  34.   # Yippee, $echo works!
  35.   :
  36. else
  37.   # Restart under the correct shell, and then maybe $echo will work.
  38.   exec $SHELL "$0" --no-reexec ${1+"$@"}
  39. fi
  40.  
  41. if test "X$1" = X--fallback-echo; then
  42.   # used as fallback echo
  43.   shift
  44.   cat <<EOF
  45. $*
  46. EOF
  47.   exit 0
  48. fi
  49.  
  50. # The name of this program.
  51. progname=`$echo "$0" | sed 's%^.*/%%'`
  52. modename="$progname"
  53.  
  54. # Constants.
  55. PROGRAM=ltmain.sh
  56. PACKAGE=libtool
  57. VERSION=1.3.2
  58. TIMESTAMP=" (1.385.2.150 1999/05/26 00:28:32)"
  59.  
  60. default_mode=
  61. help="Try \`$progname --help' for more information."
  62. magic="%%%MAGIC variable%%%"
  63. mkdir="mkdir"
  64. mv="mv -f"
  65. rm="rm -f"
  66.  
  67. # Sed substitution that helps us do robust quoting.  It backslashifies
  68. # metacharacters that are still active within double-quoted strings.
  69. Xsed='sed -e 1s/^X//'
  70. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  71. SP2NL='tr \040 \012'
  72. NL2SP='tr \012 \040'
  73.  
  74. # NLS nuisances.
  75. # Only set LANG and LC_ALL to C if already set.
  76. # These must not be set unconditionally because not all systems understand
  77. # e.g. LANG=C (notably SCO).
  78. # We save the old values to restore during execute mode.
  79. if test "${LC_ALL+set}" = set; then
  80.   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  81. fi
  82. if test "${LANG+set}" = set; then
  83.   save_LANG="$LANG"; LANG=C; export LANG
  84. fi
  85.  
  86. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  87.   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  88.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  89.   exit 1
  90. fi
  91.  
  92. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  93.   echo "$modename: not configured to build any kind of library" 1>&2
  94.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  95.   exit 1
  96. fi
  97.  
  98. # Global variables.
  99. mode=$default_mode
  100. nonopt=
  101. prev=
  102. prevopt=
  103. run=
  104. show="$echo"
  105. show_help=
  106. execute_dlfiles=
  107. lo2o="s/\\.lo\$/.${objext}/"
  108. o2lo="s/\\.${objext}\$/.lo/"
  109.  
  110. # Parse our command line options once, thoroughly.
  111. while test $# -gt 0
  112. do
  113.   arg="$1"
  114.   shift
  115.  
  116.   case "$arg" in
  117.   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  118.   *) optarg= ;;
  119.   esac
  120.  
  121.   # If the previous option needs an argument, assign it.
  122.   if test -n "$prev"; then
  123.     case "$prev" in
  124.     execute_dlfiles)
  125.       eval "$prev=\"\$$prev \$arg\""
  126.       ;;
  127.     *)
  128.       eval "$prev=\$arg"
  129.       ;;
  130.     esac
  131.  
  132.     prev=
  133.     prevopt=
  134.     continue
  135.   fi
  136.  
  137.   # Have we seen a non-optional argument yet?
  138.   case "$arg" in
  139.   --help)
  140.     show_help=yes
  141.     ;;
  142.  
  143.   --version)
  144.     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  145.     exit 0
  146.     ;;
  147.  
  148.   --config)
  149.     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
  150.     exit 0
  151.     ;;
  152.  
  153.   --debug)
  154.     echo "$progname: enabling shell trace mode"
  155.     set -x
  156.     ;;
  157.  
  158.   --dry-run | -n)
  159.     run=:
  160.     ;;
  161.  
  162.   --features)
  163.     echo "host: $host"
  164.     if test "$build_libtool_libs" = yes; then
  165.       echo "enable shared libraries"
  166.     else
  167.       echo "disable shared libraries"
  168.     fi
  169.     if test "$build_old_libs" = yes; then
  170.       echo "enable static libraries"
  171.     else
  172.       echo "disable static libraries"
  173.     fi
  174.     exit 0
  175.     ;;
  176.  
  177.   --finish) mode="finish" ;;
  178.  
  179.   --mode) prevopt="--mode" prev=mode ;;
  180.   --mode=*) mode="$optarg" ;;
  181.  
  182.   --quiet | --silent)
  183.     show=:
  184.     ;;
  185.  
  186.   -dlopen)
  187.     prevopt="-dlopen"
  188.     prev=execute_dlfiles
  189.     ;;
  190.  
  191.   -*)
  192.     $echo "$modename: unrecognized option \`$arg'" 1>&2
  193.     $echo "$help" 1>&2
  194.     exit 1
  195.     ;;
  196.  
  197.   *)
  198.     nonopt="$arg"
  199.     break
  200.     ;;
  201.   esac
  202. done
  203.  
  204. if test -n "$prevopt"; then
  205.   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  206.   $echo "$help" 1>&2
  207.   exit 1
  208. fi
  209.  
  210. if test -z "$show_help"; then
  211.  
  212.   # Infer the operation mode.
  213.   if test -z "$mode"; then
  214.     case "$nonopt" in
  215.     *cc | *++ | gcc* | *-gcc*)
  216.       mode=link
  217.       for arg
  218.       do
  219.     case "$arg" in
  220.     -c)
  221.        mode=compile
  222.        break
  223.        ;;
  224.     esac
  225.       done
  226.       ;;
  227.     *db | *dbx | *strace | *truss)
  228.       mode=execute
  229.       ;;
  230.     *install*|cp|mv)
  231.       mode=install
  232.       ;;
  233.     *rm)
  234.       mode=uninstall
  235.       ;;
  236.     *)
  237.       # If we have no mode, but dlfiles were specified, then do execute mode.
  238.       test -n "$execute_dlfiles" && mode=execute
  239.  
  240.       # Just use the default operation mode.
  241.       if test -z "$mode"; then
  242.     if test -n "$nonopt"; then
  243.       $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  244.     else
  245.       $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  246.     fi
  247.       fi
  248.       ;;
  249.     esac
  250.   fi
  251.  
  252.   # Only execute mode is allowed to have -dlopen flags.
  253.   if test -n "$execute_dlfiles" && test "$mode" != execute; then
  254.     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  255.     $echo "$help" 1>&2
  256.     exit 1
  257.   fi
  258.  
  259.   # Change the help message to a mode-specific one.
  260.   generic_help="$help"
  261.   help="Try \`$modename --help --mode=$mode' for more information."
  262.  
  263.   # These modes are in order of execution frequency so that they run quickly.
  264.   case "$mode" in
  265.   # libtool compile mode
  266.   compile)
  267.     modename="$modename: compile"
  268.     # Get the compilation command and the source file.
  269.     base_compile=
  270.     lastarg=
  271.     srcfile="$nonopt"
  272.     suppress_output=
  273.  
  274.     user_target=no
  275.     for arg
  276.     do
  277.       # Accept any command-line options.
  278.       case "$arg" in
  279.       -o)
  280.     if test "$user_target" != "no"; then
  281.       $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  282.       exit 1
  283.     fi
  284.     user_target=next
  285.     ;;
  286.  
  287.       -static)
  288.     build_old_libs=yes
  289.     continue
  290.     ;;
  291.       esac
  292.  
  293.       case "$user_target" in
  294.       next)
  295.     # The next one is the -o target name
  296.     user_target=yes
  297.     continue
  298.     ;;
  299.       yes)
  300.     # We got the output file
  301.     user_target=set
  302.     libobj="$arg"
  303.     continue
  304.     ;;
  305.       esac
  306.  
  307.       # Accept the current argument as the source file.
  308.       lastarg="$srcfile"
  309.       srcfile="$arg"
  310.  
  311.       # Aesthetically quote the previous argument.
  312.  
  313.       # Backslashify any backslashes, double quotes, and dollar signs.
  314.       # These are the only characters that are still specially
  315.       # interpreted inside of double-quoted scrings.
  316.       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  317.  
  318.       # Double-quote args containing other shell metacharacters.
  319.       # Many Bourne shells cannot handle close brackets correctly in scan
  320.       # sets, so we specify it separately.
  321.       case "$lastarg" in
  322.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  323.     lastarg="\"$lastarg\""
  324.     ;;
  325.       esac
  326.  
  327.       # Add the previous argument to base_compile.
  328.       if test -z "$base_compile"; then
  329.     base_compile="$lastarg"
  330.       else
  331.     base_compile="$base_compile $lastarg"
  332.       fi
  333.     done
  334.  
  335.     case "$user_target" in
  336.     set)
  337.       ;;
  338.     no)
  339.       # Get the name of the library object.
  340.       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  341.       ;;
  342.     *)
  343.       $echo "$modename: you must specify a target with \`-o'" 1>&2
  344.       exit 1
  345.       ;;
  346.     esac
  347.  
  348.     # Recognize several different file suffixes.
  349.     # If the user specifies -o file.o, it is replaced with file.lo
  350.     xform='[cCFSfmso]'
  351.     case "$libobj" in
  352.     *.ada) xform=ada ;;
  353.     *.adb) xform=adb ;;
  354.     *.ads) xform=ads ;;
  355.     *.asm) xform=asm ;;
  356.     *.c++) xform=c++ ;;
  357.     *.cc) xform=cc ;;
  358.     *.cpp) xform=cpp ;;
  359.     *.cxx) xform=cxx ;;
  360.     *.f90) xform=f90 ;;
  361.     *.for) xform=for ;;
  362.     esac
  363.  
  364.     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  365.  
  366.     case "$libobj" in
  367.     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  368.     *)
  369.       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  370.       exit 1
  371.       ;;
  372.     esac
  373.  
  374.     if test -z "$base_compile"; then
  375.       $echo "$modename: you must specify a compilation command" 1>&2
  376.       $echo "$help" 1>&2
  377.       exit 1
  378.     fi
  379.  
  380.     # Delete any leftover library objects.
  381.     if test "$build_old_libs" = yes; then
  382.       removelist="$obj $libobj"
  383.     else
  384.       removelist="$libobj"
  385.     fi
  386.  
  387.     $run $rm $removelist
  388.     trap "$run $rm $removelist; exit 1" 1 2 15
  389.  
  390.     # Calculate the filename of the output object if compiler does
  391.     # not support -o with -c
  392.     if test "$compiler_c_o" = no; then
  393.       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
  394.       lockfile="$output_obj.lock"
  395.       removelist="$removelist $output_obj $lockfile"
  396.       trap "$run $rm $removelist; exit 1" 1 2 15
  397.     else
  398.       need_locks=no
  399.       lockfile=
  400.     fi
  401.  
  402.     # Lock this critical section if it is needed
  403.     # We use this script file to make the link, it avoids creating a new file
  404.     if test "$need_locks" = yes; then
  405.       until ln "$0" "$lockfile" 2>/dev/null; do
  406.     $show "Waiting for $lockfile to be removed"
  407.     sleep 2
  408.       done
  409.     elif test "$need_locks" = warn; then
  410.       if test -f "$lockfile"; then
  411.     echo "\
  412. *** ERROR, $lockfile exists and contains:
  413. `cat $lockfile 2>/dev/null`
  414.  
  415. This indicates that another process is trying to use the same
  416. temporary object file, and libtool could not work around it because
  417. your compiler does not support \`-c' and \`-o' together.  If you
  418. repeat this compilation, it may succeed, by chance, but you had better
  419. avoid parallel builds (make -j) in this platform, or get a better
  420. compiler."
  421.  
  422.     $run $rm $removelist
  423.     exit 1
  424.       fi
  425.       echo $srcfile > "$lockfile"
  426.     fi
  427.  
  428.     if test -n "$fix_srcfile_path"; then
  429.       eval srcfile=\"$fix_srcfile_path\"
  430.     fi
  431.  
  432.     # Only build a PIC object if we are building libtool libraries.
  433.     if test "$build_libtool_libs" = yes; then
  434.       # Without this assignment, base_compile gets emptied.
  435.       fbsd_hideous_sh_bug=$base_compile
  436.  
  437.       # All platforms use -DPIC, to notify preprocessed assembler code.
  438.       command="$base_compile $pic_flag -DPIC $srcfile"
  439.       if test "$build_old_libs" = yes; then
  440.     lo_libobj="$libobj"
  441.     dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  442.     if test "X$dir" = "X$libobj"; then
  443.       dir="$objdir"
  444.     else
  445.       dir="$dir/$objdir"
  446.     fi
  447.     libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  448.  
  449.     if test -d "$dir"; then
  450.       $show "$rm $libobj"
  451.       $run $rm $libobj
  452.     else
  453.       $show "$mkdir $dir"
  454.       $run $mkdir $dir
  455.       status=$?
  456.       if test $status -ne 0 && test ! -d $dir; then
  457.         exit $status
  458.       fi
  459.     fi
  460.       fi
  461.       if test "$compiler_o_lo" = yes; then
  462.     output_obj="$libobj"
  463.     command="$command -o $output_obj"
  464.       elif test "$compiler_c_o" = yes; then
  465.     output_obj="$obj"
  466.     command="$command -o $output_obj"
  467.       fi
  468.  
  469.       $run $rm "$output_obj"
  470.       $show "$command"
  471.       if $run eval "$command"; then :
  472.       else
  473.     test -n "$output_obj" && $run $rm $removelist
  474.     exit 1
  475.       fi
  476.  
  477.       if test "$need_locks" = warn &&
  478.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  479.     echo "\
  480. *** ERROR, $lockfile contains:
  481. `cat $lockfile 2>/dev/null`
  482.  
  483. but it should contain:
  484. $srcfile
  485.  
  486. This indicates that another process is trying to use the same
  487. temporary object file, and libtool could not work around it because
  488. your compiler does not support \`-c' and \`-o' together.  If you
  489. repeat this compilation, it may succeed, by chance, but you had better
  490. avoid parallel builds (make -j) in this platform, or get a better
  491. compiler."
  492.  
  493.     $run $rm $removelist
  494.     exit 1
  495.       fi
  496.  
  497.       # Just move the object if needed, then go on to compile the next one
  498.       if test x"$output_obj" != x"$libobj"; then
  499.     $show "$mv $output_obj $libobj"
  500.     if $run $mv $output_obj $libobj; then :
  501.     else
  502.       error=$?
  503.       $run $rm $removelist
  504.       exit $error
  505.     fi
  506.       fi
  507.  
  508.       # If we have no pic_flag, then copy the object into place and finish.
  509.       if test -z "$pic_flag" && test "$build_old_libs" = yes; then
  510.     # Rename the .lo from within objdir to obj
  511.     if test -f $obj; then
  512.       $show $rm $obj
  513.       $run $rm $obj
  514.     fi
  515.  
  516.     $show "$mv $libobj $obj"
  517.     if $run $mv $libobj $obj; then :
  518.     else
  519.       error=$?
  520.       $run $rm $removelist
  521.       exit $error
  522.     fi
  523.  
  524.     # Now arrange that obj and lo_libobj become the same file
  525.     $show "$LN_S $obj $lo_libobj"
  526.     if $run $LN_S $obj $lo_libobj; then
  527.       exit 0
  528.     else
  529.       error=$?
  530.       $run $rm $removelist
  531.       exit $error
  532.     fi
  533.       fi
  534.  
  535.       # Allow error messages only from the first compilation.
  536.       suppress_output=' >/dev/null 2>&1'
  537.     fi
  538.  
  539.     # Only build a position-dependent object if we build old libraries.
  540.     if test "$build_old_libs" = yes; then
  541.       command="$base_compile $srcfile"
  542.       if test "$compiler_c_o" = yes; then
  543.     command="$command -o $obj"
  544.     output_obj="$obj"
  545.       fi
  546.  
  547.       # Suppress compiler output if we already did a PIC compilation.
  548.       command="$command$suppress_output"
  549.       $run $rm "$output_obj"
  550.       $show "$command"
  551.       if $run eval "$command"; then :
  552.       else
  553.     $run $rm $removelist
  554.     exit 1
  555.       fi
  556.  
  557.       if test "$need_locks" = warn &&
  558.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  559.     echo "\
  560. *** ERROR, $lockfile contains:
  561. `cat $lockfile 2>/dev/null`
  562.  
  563. but it should contain:
  564. $srcfile
  565.  
  566. This indicates that another process is trying to use the same
  567. temporary object file, and libtool could not work around it because
  568. your compiler does not support \`-c' and \`-o' together.  If you
  569. repeat this compilation, it may succeed, by chance, but you had better
  570. avoid parallel builds (make -j) in this platform, or get a better
  571. compiler."
  572.  
  573.     $run $rm $removelist
  574.     exit 1
  575.       fi
  576.  
  577.       # Just move the object if needed
  578.       if test x"$output_obj" != x"$obj"; then
  579.     $show "$mv $output_obj $obj"
  580.     if $run $mv $output_obj $obj; then :
  581.     else
  582.       error=$?
  583.       $run $rm $removelist
  584.       exit $error
  585.     fi
  586.       fi
  587.  
  588.       # Create an invalid libtool object if no PIC, so that we do not
  589.       # accidentally link it into a program.
  590.       if test "$build_libtool_libs" != yes; then
  591.     $show "echo timestamp > $libobj"
  592.     $run eval "echo timestamp > \$libobj" || exit $?
  593.       else
  594.     # Move the .lo from within objdir
  595.     $show "$mv $libobj $lo_libobj"
  596.     if $run $mv $libobj $lo_libobj; then :
  597.     else
  598.       error=$?
  599.       $run $rm $removelist
  600.       exit $error
  601.     fi
  602.       fi
  603.     fi
  604.  
  605.     # Unlock the critical section if it was locked
  606.     if test "$need_locks" != no; then
  607.       $rm "$lockfile"
  608.     fi
  609.  
  610.     exit 0
  611.     ;;
  612.  
  613.   # libtool link mode
  614.   link)
  615.     modename="$modename: link"
  616.     C_compiler="$CC" # save it, to compile generated C sources
  617.     CC="$nonopt"
  618.     case "$host" in
  619.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  620.       # It is impossible to link a dll without this setting, and
  621.       # we shouldn't force the makefile maintainer to figure out
  622.       # which system we are compiling for in order to pass an extra
  623.       # flag for every libtool invokation.
  624.       # allow_undefined=no
  625.  
  626.       # FIXME: Unfortunately, there are problems with the above when trying
  627.       # to make a dll which has undefined symbols, in which case not
  628.       # even a static library is built.  For now, we need to specify
  629.       # -no-undefined on the libtool link line when we can be certain
  630.       # that all symbols are satisfied, otherwise we get a static library.
  631.       allow_undefined=yes
  632.  
  633.       # This is a source program that is used to create dlls on Windows
  634.       # Don't remove nor modify the starting and closing comments
  635. # /* ltdll.c starts here */
  636. # #define WIN32_LEAN_AND_MEAN
  637. # #include <windows.h>
  638. # #undef WIN32_LEAN_AND_MEAN
  639. # #include <stdio.h>
  640. #
  641. # #ifdef __cplusplus
  642. # extern "C" {
  643. # #endif
  644. # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
  645. # #ifdef __cplusplus
  646. # }
  647. # #endif
  648. #
  649. # #include <cygwin/cygwin_dll.h>
  650. # DECLARE_CYGWIN_DLL( DllMain );
  651. # HINSTANCE __hDllInstance_base;
  652. #
  653. # BOOL APIENTRY
  654. # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
  655. # {
  656. #   __hDllInstance_base = hInst;
  657. #   return TRUE;
  658. # }
  659. # /* ltdll.c ends here */
  660.       # This is a source program that is used to create import libraries
  661.       # on Windows for dlls which lack them. Don't remove nor modify the
  662.       # starting and closing comments
  663. # /* impgen.c starts here */
  664. # /*   Copyright (C) 1999 Free Software Foundation, Inc.
  665. #  This file is part of GNU libtool.
  666. #  This program is free software; you can redistribute it and/or modify
  667. #  it under the terms of the GNU General Public License as published by
  668. #  the Free Software Foundation; either version 2 of the License, or
  669. #  (at your option) any later version.
  670. #  This program is distributed in the hope that it will be useful,
  671. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  672. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  673. #  GNU General Public License for more details.
  674. #  You should have received a copy of the GNU General Public License
  675. #  along with this program; if not, write to the Free Software
  676. #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  677. #  */
  678. #  #include <stdio.h>        /* for printf() */
  679. #  #include <unistd.h>        /* for open(), lseek(), read() */
  680. #  #include <fcntl.h>        /* for O_RDONLY, O_BINARY */
  681. #  #include <string.h>        /* for strdup() */
  682. #  static unsigned int
  683. #  pe_get16 (fd, offset)
  684. #       int fd;
  685. #       int offset;
  686. #  {
  687. #    unsigned char b[2];
  688. #    lseek (fd, offset, SEEK_SET);
  689. #    read (fd, b, 2);
  690. #    return b[0] + (b[1]<<8);
  691. #  }
  692. #  static unsigned int
  693. #  pe_get32 (fd, offset)
  694. #      int fd;
  695. #      int offset;
  696. #  {
  697. #    unsigned char b[4];
  698. #    lseek (fd, offset, SEEK_SET);
  699. #    read (fd, b, 4);
  700. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  701. #  }
  702. #  static unsigned int
  703. #  pe_as32 (ptr)
  704. #       void *ptr;
  705. #  {
  706. #    unsigned char *b = ptr;
  707. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  708. #  }
  709. #  int
  710. #  main (argc, argv)
  711. #      int argc;
  712. #      char *argv[];
  713. #  {
  714. #      int dll;
  715. #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
  716. #      unsigned long export_rva, export_size, nsections, secptr, expptr;
  717. #      unsigned long name_rvas, nexp;
  718. #      unsigned char *expdata, *erva;
  719. #      char *filename, *dll_name;
  720. #      filename = argv[1];
  721. #      dll = open(filename, O_RDONLY|O_BINARY);
  722. #      if (!dll)
  723. #      return 1;
  724. #      dll_name = filename;
  725. #    
  726. #      for (i=0; filename[i]; i++)
  727. #      if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
  728. #          dll_name = filename + i +1;
  729. #      pe_header_offset = pe_get32 (dll, 0x3c);
  730. #      opthdr_ofs = pe_header_offset + 4 + 20;
  731. #      num_entries = pe_get32 (dll, opthdr_ofs + 92);
  732. #      if (num_entries < 1) /* no exports */
  733. #      return 1;
  734. #      export_rva = pe_get32 (dll, opthdr_ofs + 96);
  735. #      export_size = pe_get32 (dll, opthdr_ofs + 100);
  736. #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  737. #      secptr = (pe_header_offset + 4 + 20 +
  738. #            pe_get16 (dll, pe_header_offset + 4 + 16));
  739. #      expptr = 0;
  740. #      for (i = 0; i < nsections; i++)
  741. #      {
  742. #      char sname[8];
  743. #      unsigned long secptr1 = secptr + 40 * i;
  744. #      unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  745. #      unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  746. #      unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  747. #      lseek(dll, secptr1, SEEK_SET);
  748. #      read(dll, sname, 8);
  749. #      if (vaddr <= export_rva && vaddr+vsize > export_rva)
  750. #      {
  751. #          expptr = fptr + (export_rva - vaddr);
  752. #          if (export_rva + export_size > vaddr + vsize)
  753. #          export_size = vsize - (export_rva - vaddr);
  754. #          break;
  755. #      }
  756. #      }
  757. #      expdata = (unsigned char*)malloc(export_size);
  758. #      lseek (dll, expptr, SEEK_SET);
  759. #      read (dll, expdata, export_size);
  760. #      erva = expdata - export_rva;
  761. #      nexp = pe_as32 (expdata+24);
  762. #      name_rvas = pe_as32 (expdata+32);
  763. #      printf ("EXPORTS\n");
  764. #      for (i = 0; i<nexp; i++)
  765. #      {
  766. #      unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  767. #      printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  768. #      }
  769. #      return 0;
  770. #  }
  771. # /* impgen.c ends here */
  772.       ;;
  773.     *)
  774.       allow_undefined=yes
  775.       ;;
  776.     esac
  777.     compile_command="$CC"
  778.     finalize_command="$CC"
  779.  
  780.     compile_rpath=
  781.     finalize_rpath=
  782.     compile_shlibpath=
  783.     finalize_shlibpath=
  784.     convenience=
  785.     old_convenience=
  786.     deplibs=
  787.     linkopts=
  788.  
  789.     if test -n "$shlibpath_var"; then
  790.       # get the directories listed in $shlibpath_var
  791.       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  792.     else
  793.       lib_search_path=
  794.     fi
  795.     # now prepend the system-specific ones
  796.     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  797.     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  798.     
  799.     avoid_version=no
  800.     dlfiles=
  801.     dlprefiles=
  802.     dlself=no
  803.     export_dynamic=no
  804.     export_symbols=
  805.     export_symbols_regex=
  806.     generated=
  807.     libobjs=
  808.     link_against_libtool_libs=
  809.     ltlibs=
  810.     module=no
  811.     objs=
  812.     prefer_static_libs=no
  813.     preload=no
  814.     prev=
  815.     prevarg=
  816.     release=
  817.     rpath=
  818.     xrpath=
  819.     perm_rpath=
  820.     temp_rpath=
  821.     thread_safe=no
  822.     vinfo=
  823.  
  824.     # We need to know -static, to get the right output filenames.
  825.     for arg
  826.     do
  827.       case "$arg" in
  828.       -all-static | -static)
  829.     if test "X$arg" = "X-all-static"; then
  830.       if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  831.         $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  832.       fi
  833.       if test -n "$link_static_flag"; then
  834.         dlopen_self=$dlopen_self_static
  835.       fi
  836.     else
  837.       if test -z "$pic_flag" && test -n "$link_static_flag"; then
  838.         dlopen_self=$dlopen_self_static
  839.       fi
  840.     fi
  841.     build_libtool_libs=no
  842.     build_old_libs=yes
  843.     prefer_static_libs=yes
  844.     break
  845.     ;;
  846.       esac
  847.     done
  848.  
  849.     # See if our shared archives depend on static archives.
  850.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  851.  
  852.     # Go through the arguments, transforming them on the way.
  853.     while test $# -gt 0; do
  854.       arg="$1"
  855.       shift
  856.  
  857.       # If the previous option needs an argument, assign it.
  858.       if test -n "$prev"; then
  859.     case "$prev" in
  860.     output)
  861.       compile_command="$compile_command @OUTPUT@"
  862.       finalize_command="$finalize_command @OUTPUT@"
  863.       ;;
  864.     esac
  865.  
  866.     case "$prev" in
  867.     dlfiles|dlprefiles)
  868.       if test "$preload" = no; then
  869.         # Add the symbol object into the linking commands.
  870.         compile_command="$compile_command @SYMFILE@"
  871.         finalize_command="$finalize_command @SYMFILE@"
  872.         preload=yes
  873.       fi
  874.       case "$arg" in
  875.       *.la | *.lo) ;;  # We handle these cases below.
  876.       self)
  877.         if test "$prev" = dlprefiles; then
  878.           dlself=yes
  879.         elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  880.           dlself=yes
  881.         else
  882.           dlself=needless
  883.           export_dynamic=yes
  884.         fi
  885.         prev=
  886.         continue
  887.         ;;
  888.       *)
  889.         if test "$prev" = dlfiles; then
  890.           dlfiles="$dlfiles $arg"
  891.         else
  892.           dlprefiles="$dlprefiles $arg"
  893.         fi
  894.         prev=
  895.         ;;
  896.       esac
  897.       ;;
  898.     expsyms)
  899.       export_symbols="$arg"
  900.       if test ! -f "$arg"; then
  901.         $echo "$modename: symbol file \`$arg' does not exist"
  902.         exit 1
  903.       fi
  904.       prev=
  905.       continue
  906.       ;;
  907.     expsyms_regex)
  908.       export_symbols_regex="$arg"
  909.       prev=
  910.       continue
  911.       ;;
  912.     release)
  913.       release="-$arg"
  914.       prev=
  915.       continue
  916.       ;;
  917.     rpath | xrpath)
  918.       # We need an absolute path.
  919.       case "$arg" in
  920.       [\\/]* | [A-Za-z]:[\\/]*) ;;
  921.       *)
  922.         $echo "$modename: only absolute run-paths are allowed" 1>&2
  923.         exit 1
  924.         ;;
  925.       esac
  926.       if test "$prev" = rpath; then
  927.         case "$rpath " in
  928.         *" $arg "*) ;;
  929.         *) rpath="$rpath $arg" ;;
  930.         esac
  931.       else
  932.         case "$xrpath " in
  933.         *" $arg "*) ;;
  934.         *) xrpath="$xrpath $arg" ;;
  935.         esac
  936.       fi
  937.       prev=
  938.       continue
  939.       ;;
  940.     *)
  941.       eval "$prev=\"\$arg\""
  942.       prev=
  943.       continue
  944.       ;;
  945.     esac
  946.       fi
  947.  
  948.       prevarg="$arg"
  949.  
  950.       case "$arg" in
  951.       -all-static)
  952.     if test -n "$link_static_flag"; then
  953.       compile_command="$compile_command $link_static_flag"
  954.       finalize_command="$finalize_command $link_static_flag"
  955.     fi
  956.     continue
  957.     ;;
  958.  
  959.       -allow-undefined)
  960.     # FIXME: remove this flag sometime in the future.
  961.     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  962.     continue
  963.     ;;
  964.  
  965.       -avoid-version)
  966.     avoid_version=yes
  967.     continue
  968.     ;;
  969.  
  970.       -dlopen)
  971.     prev=dlfiles
  972.     continue
  973.     ;;
  974.  
  975.       -dlpreopen)
  976.     prev=dlprefiles
  977.     continue
  978.     ;;
  979.  
  980.       -export-dynamic)
  981.     export_dynamic=yes
  982.     continue
  983.     ;;
  984.  
  985.       -export-symbols | -export-symbols-regex)
  986.     if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  987.       $echo "$modename: not more than one -exported-symbols argument allowed"
  988.       exit 1
  989.     fi
  990.     if test "X$arg" = "X-export-symbols"; then
  991.       prev=expsyms
  992.     else
  993.       prev=expsyms_regex
  994.     fi
  995.     continue
  996.     ;;
  997.  
  998.       -L*)
  999.     dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1000.     # We need an absolute path.
  1001.     case "$dir" in
  1002.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1003.     *)
  1004.       absdir=`cd "$dir" && pwd`
  1005.       if test -z "$absdir"; then
  1006.         $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1007.         $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1008.         absdir="$dir"
  1009.       fi
  1010.       dir="$absdir"
  1011.       ;;
  1012.     esac
  1013.     case " $deplibs " in
  1014.     *" $arg "*) ;;
  1015.     *) deplibs="$deplibs $arg";;
  1016.     esac
  1017.     case " $lib_search_path " in
  1018.     *" $dir "*) ;;
  1019.     *) lib_search_path="$lib_search_path $dir";;
  1020.     esac
  1021.     case "$host" in
  1022.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1023.       dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1024.       case ":$dllsearchpath:" in
  1025.       ::) dllsearchpath="$dllsearchdir";;
  1026.       *":$dllsearchdir:"*) ;;
  1027.       *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  1028.       esac
  1029.       ;;
  1030.     esac
  1031.     ;;
  1032.  
  1033.       -l*)
  1034.     if test "$arg" = "-lc"; then
  1035.       case "$host" in
  1036.       *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1037.         # These systems don't actually have c library (as such)
  1038.         continue
  1039.         ;;
  1040.       esac
  1041.     elif test "$arg" = "-lm"; then
  1042.       case "$host" in
  1043.       *-*-cygwin* | *-*-beos*)
  1044.         # These systems don't actually have math library (as such)
  1045.         continue
  1046.         ;;
  1047.       esac
  1048.     fi
  1049.     deplibs="$deplibs $arg"
  1050.     ;;
  1051.  
  1052.       -module)
  1053.     module=yes
  1054.     continue
  1055.     ;;
  1056.  
  1057.       -no-undefined)
  1058.     allow_undefined=no
  1059.     continue
  1060.     ;;
  1061.  
  1062.       -o) prev=output ;;
  1063.  
  1064.       -release)
  1065.     prev=release
  1066.     continue
  1067.     ;;
  1068.  
  1069.       -rpath)
  1070.     prev=rpath
  1071.     continue
  1072.     ;;
  1073.  
  1074.       -R)
  1075.     prev=xrpath
  1076.     continue
  1077.     ;;
  1078.  
  1079.       -R*)
  1080.     dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1081.     # We need an absolute path.
  1082.     case "$dir" in
  1083.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1084.     *)
  1085.       $echo "$modename: only absolute run-paths are allowed" 1>&2
  1086.       exit 1
  1087.       ;;
  1088.     esac
  1089.     case "$xrpath " in
  1090.     *" $dir "*) ;;
  1091.     *) xrpath="$xrpath $dir" ;;
  1092.     esac
  1093.     continue
  1094.     ;;
  1095.  
  1096.       -static)
  1097.     # If we have no pic_flag, then this is the same as -all-static.
  1098.     if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1099.       compile_command="$compile_command $link_static_flag"
  1100.       finalize_command="$finalize_command $link_static_flag"
  1101.     fi
  1102.     continue
  1103.     ;;
  1104.  
  1105.       -thread-safe)
  1106.     thread_safe=yes
  1107.     continue
  1108.     ;;
  1109.  
  1110.       -version-info)
  1111.     prev=vinfo
  1112.     continue
  1113.     ;;
  1114.  
  1115.       # Some other compiler flag.
  1116.       -* | +*)
  1117.     # Unknown arguments in both finalize_command and compile_command need
  1118.     # to be aesthetically quoted because they are evaled later.
  1119.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1120.     case "$arg" in
  1121.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1122.       arg="\"$arg\""
  1123.       ;;
  1124.     esac
  1125.     ;;
  1126.  
  1127.       *.o | *.obj | *.a | *.lib)
  1128.     # A standard object.
  1129.     objs="$objs $arg"
  1130.     ;;
  1131.  
  1132.       *.lo)
  1133.     # A library object.
  1134.     if test "$prev" = dlfiles; then
  1135.       dlfiles="$dlfiles $arg"
  1136.       if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1137.         prev=
  1138.         continue
  1139.       else
  1140.         # If libtool objects are unsupported, then we need to preload.
  1141.         prev=dlprefiles
  1142.       fi
  1143.     fi
  1144.  
  1145.     if test "$prev" = dlprefiles; then
  1146.       # Preload the old-style object.
  1147.       dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1148.       prev=
  1149.     fi
  1150.     libobjs="$libobjs $arg"
  1151.     ;;
  1152.  
  1153.       *.la)
  1154.     # A libtool-controlled library.
  1155.  
  1156.     dlname=
  1157.     libdir=
  1158.     library_names=
  1159.     old_library=
  1160.  
  1161.     # Check to see that this really is a libtool archive.
  1162.     if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1163.     else
  1164.       $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1165.       exit 1
  1166.     fi
  1167.  
  1168.     # If the library was installed with an old release of libtool,
  1169.     # it will not redefine variable installed.
  1170.     installed=yes
  1171.  
  1172.     # Read the .la file
  1173.     # If there is no directory component, then add one.
  1174.     case "$arg" in
  1175.     */* | *\\*) . $arg ;;
  1176.     *) . ./$arg ;;
  1177.     esac
  1178.  
  1179.     # Get the name of the library we link against.
  1180.     linklib=
  1181.     for l in $old_library $library_names; do
  1182.       linklib="$l"
  1183.     done
  1184.  
  1185.     if test -z "$linklib"; then
  1186.       $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1187.       exit 1
  1188.     fi
  1189.  
  1190.     # Find the relevant object directory and library name.
  1191.     name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1192.  
  1193.     if test "X$installed" = Xyes; then
  1194.       dir="$libdir"
  1195.     else
  1196.       dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1197.       if test "X$dir" = "X$arg"; then
  1198.         dir="$objdir"
  1199.       else
  1200.         dir="$dir/$objdir"
  1201.       fi
  1202.     fi
  1203.  
  1204.     if test -n "$dependency_libs"; then
  1205.       # Extract -R from dependency_libs
  1206.       temp_deplibs=
  1207.       for deplib in $dependency_libs; do
  1208.         case "$deplib" in
  1209.         -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1210.          case " $rpath $xrpath " in
  1211.          *" $temp_xrpath "*) ;;
  1212.          *) xrpath="$xrpath $temp_xrpath";;
  1213.          esac;;
  1214.         -L*) case "$compile_command $temp_deplibs " in
  1215.          *" $deplib "*) ;;
  1216.          *) temp_deplibs="$temp_deplibs $deplib";;
  1217.          esac;;
  1218.         *) temp_deplibs="$temp_deplibs $deplib";;
  1219.         esac
  1220.       done
  1221.       dependency_libs="$temp_deplibs"
  1222.     fi
  1223.  
  1224.     if test -z "$libdir"; then
  1225.       # It is a libtool convenience library, so add in its objects.
  1226.       convenience="$convenience $dir/$old_library"
  1227.       old_convenience="$old_convenience $dir/$old_library"
  1228.       deplibs="$deplibs$dependency_libs"
  1229.       compile_command="$compile_command $dir/$old_library$dependency_libs"
  1230.       finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1231.       continue
  1232.     fi
  1233.  
  1234.     # This library was specified with -dlopen.
  1235.     if test "$prev" = dlfiles; then
  1236.       dlfiles="$dlfiles $arg"
  1237.       if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1238.         # If there is no dlname, no dlopen support or we're linking statically,
  1239.         # we need to preload.
  1240.         prev=dlprefiles
  1241.       else
  1242.         # We should not create a dependency on this library, but we
  1243.         # may need any libraries it requires.
  1244.         compile_command="$compile_command$dependency_libs"
  1245.         finalize_command="$finalize_command$dependency_libs"
  1246.         prev=
  1247.         continue
  1248.       fi
  1249.     fi
  1250.  
  1251.     # The library was specified with -dlpreopen.
  1252.     if test "$prev" = dlprefiles; then
  1253.       # Prefer using a static library (so that no silly _DYNAMIC symbols
  1254.       # are required to link).
  1255.       if test -n "$old_library"; then
  1256.         dlprefiles="$dlprefiles $dir/$old_library"
  1257.       else
  1258.         dlprefiles="$dlprefiles $dir/$linklib"
  1259.       fi
  1260.       prev=
  1261.     fi
  1262.  
  1263.     if test -n "$library_names" &&
  1264.        { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1265.       link_against_libtool_libs="$link_against_libtool_libs $arg"
  1266.       if test -n "$shlibpath_var"; then
  1267.         # Make sure the rpath contains only unique directories.
  1268.         case "$temp_rpath " in
  1269.         *" $dir "*) ;;
  1270.         *) temp_rpath="$temp_rpath $dir" ;;
  1271.         esac
  1272.       fi
  1273.  
  1274.       # We need an absolute path.
  1275.       case "$dir" in
  1276.       [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1277.       *)
  1278.         absdir=`cd "$dir" && pwd`
  1279.         if test -z "$absdir"; then
  1280.           $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1281.           $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1282.           absdir="$dir"
  1283.         fi
  1284.         ;;
  1285.       esac
  1286.       
  1287.       # This is the magic to use -rpath.
  1288.       # Skip directories that are in the system default run-time
  1289.       # search path, unless they have been requested with -R.
  1290.       case " $sys_lib_dlsearch_path " in
  1291.       *" $absdir "*) ;;
  1292.       *)
  1293.         case "$compile_rpath " in
  1294.         *" $absdir "*) ;;
  1295.         *) compile_rpath="$compile_rpath $absdir" 
  1296.         esac
  1297.         ;;
  1298.       esac
  1299.  
  1300.       case " $sys_lib_dlsearch_path " in
  1301.       *" $libdir "*) ;;
  1302.       *)
  1303.         case "$finalize_rpath " in
  1304.         *" $libdir "*) ;;
  1305.         *) finalize_rpath="$finalize_rpath $libdir"
  1306.         esac
  1307.         ;;
  1308.       esac
  1309.  
  1310.       lib_linked=yes
  1311.       case "$hardcode_action" in
  1312.       immediate | unsupported)
  1313.         if test "$hardcode_direct" = no; then
  1314.           compile_command="$compile_command $dir/$linklib"
  1315.           deplibs="$deplibs $dir/$linklib"
  1316.           case "$host" in
  1317.           *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1318.         dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1319.         if test -n "$dllsearchpath"; then
  1320.           dllsearchpath="$dllsearchpath:$dllsearchdir"
  1321.         else
  1322.           dllsearchpath="$dllsearchdir"
  1323.         fi
  1324.         ;;
  1325.           esac
  1326.         elif test "$hardcode_minus_L" = no; then
  1327.           case "$host" in
  1328.           *-*-sunos*)
  1329.         compile_shlibpath="$compile_shlibpath$dir:"
  1330.         ;;
  1331.           esac
  1332.           case "$compile_command " in
  1333.           *" -L$dir "*) ;;
  1334.           *) compile_command="$compile_command -L$dir";;
  1335.           esac
  1336.           compile_command="$compile_command -l$name"
  1337.           deplibs="$deplibs -L$dir -l$name"
  1338.         elif test "$hardcode_shlibpath_var" = no; then
  1339.           case ":$compile_shlibpath:" in
  1340.           *":$dir:"*) ;;
  1341.           *) compile_shlibpath="$compile_shlibpath$dir:";;
  1342.           esac
  1343.           compile_command="$compile_command -l$name"
  1344.           deplibs="$deplibs -l$name"
  1345.         else
  1346.           lib_linked=no
  1347.         fi
  1348.         ;;
  1349.  
  1350.       relink)
  1351.         if test "$hardcode_direct" = yes; then
  1352.           compile_command="$compile_command $absdir/$linklib"
  1353.           deplibs="$deplibs $absdir/$linklib"
  1354.         elif test "$hardcode_minus_L" = yes; then
  1355.           case "$compile_command " in
  1356.           *" -L$absdir "*) ;;
  1357.           *) compile_command="$compile_command -L$absdir";;
  1358.           esac
  1359.           compile_command="$compile_command -l$name"
  1360.           deplibs="$deplibs -L$absdir -l$name"
  1361.         elif test "$hardcode_shlibpath_var" = yes; then
  1362.           case ":$compile_shlibpath:" in
  1363.           *":$absdir:"*) ;;
  1364.           *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1365.           esac
  1366.           compile_command="$compile_command -l$name"
  1367.           deplibs="$deplibs -l$name"
  1368.         else
  1369.           lib_linked=no
  1370.         fi
  1371.         ;;
  1372.  
  1373.       *)
  1374.         lib_linked=no
  1375.         ;;
  1376.       esac
  1377.  
  1378.       if test "$lib_linked" != yes; then
  1379.         $echo "$modename: configuration error: unsupported hardcode properties"
  1380.         exit 1
  1381.       fi
  1382.  
  1383.       # Finalize command for both is simple: just hardcode it.
  1384.       if test "$hardcode_direct" = yes; then
  1385.         finalize_command="$finalize_command $libdir/$linklib"
  1386.       elif test "$hardcode_minus_L" = yes; then
  1387.         case "$finalize_command " in
  1388.         *" -L$libdir "*) ;;
  1389.         *) finalize_command="$finalize_command -L$libdir";;
  1390.         esac
  1391.         finalize_command="$finalize_command -l$name"
  1392.       elif test "$hardcode_shlibpath_var" = yes; then
  1393.         case ":$finalize_shlibpath:" in
  1394.         *":$libdir:"*) ;;
  1395.         *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1396.         esac
  1397.         finalize_command="$finalize_command -l$name"
  1398.       else
  1399.         # We cannot seem to hardcode it, guess we'll fake it.
  1400.         case "$finalize_command " in
  1401.         *" -L$dir "*) ;;
  1402.         *) finalize_command="$finalize_command -L$libdir";;
  1403.         esac
  1404.         finalize_command="$finalize_command -l$name"
  1405.       fi
  1406.     else
  1407.       # Transform directly to old archives if we don't build new libraries.
  1408.       if test -n "$pic_flag" && test -z "$old_library"; then
  1409.         $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1410.         exit 1
  1411.       fi
  1412.  
  1413.       # Here we assume that one of hardcode_direct or hardcode_minus_L
  1414.       # is not unsupported.  This is valid on all known static and
  1415.       # shared platforms.
  1416.       if test "$hardcode_direct" != unsupported; then
  1417.         test -n "$old_library" && linklib="$old_library"
  1418.         compile_command="$compile_command $dir/$linklib"
  1419.         finalize_command="$finalize_command $dir/$linklib"
  1420.       else
  1421.         case "$compile_command " in
  1422.         *" -L$dir "*) ;;
  1423.         *) compile_command="$compile_command -L$dir";;
  1424.         esac
  1425.         compile_command="$compile_command -l$name"
  1426.         case "$finalize_command " in
  1427.         *" -L$dir "*) ;;
  1428.         *) finalize_command="$finalize_command -L$dir";;
  1429.         esac
  1430.         finalize_command="$finalize_command -l$name"
  1431.       fi
  1432.     fi
  1433.  
  1434.     # Add in any libraries that this one depends upon.
  1435.     compile_command="$compile_command$dependency_libs"
  1436.     finalize_command="$finalize_command$dependency_libs"
  1437.     continue
  1438.     ;;
  1439.  
  1440.       # Some other compiler argument.
  1441.       *)
  1442.     # Unknown arguments in both finalize_command and compile_command need
  1443.     # to be aesthetically quoted because they are evaled later.
  1444.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1445.     case "$arg" in
  1446.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1447.       arg="\"$arg\""
  1448.       ;;
  1449.     esac
  1450.     ;;
  1451.       esac
  1452.  
  1453.       # Now actually substitute the argument into the commands.
  1454.       if test -n "$arg"; then
  1455.     compile_command="$compile_command $arg"
  1456.     finalize_command="$finalize_command $arg"
  1457.       fi
  1458.     done
  1459.  
  1460.     if test -n "$prev"; then
  1461.       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1462.       $echo "$help" 1>&2
  1463.       exit 1
  1464.     fi
  1465.  
  1466.     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1467.       eval arg=\"$export_dynamic_flag_spec\"
  1468.       compile_command="$compile_command $arg"
  1469.       finalize_command="$finalize_command $arg"
  1470.     fi
  1471.  
  1472.     oldlibs=
  1473.     # calculate the name of the file, without its directory
  1474.     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1475.     libobjs_save="$libobjs"
  1476.  
  1477.     case "$output" in
  1478.     "")
  1479.       $echo "$modename: you must specify an output file" 1>&2
  1480.       $echo "$help" 1>&2
  1481.       exit 1
  1482.       ;;
  1483.  
  1484.     *.a | *.lib)
  1485.       if test -n "$link_against_libtool_libs"; then
  1486.     $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1487.     exit 1
  1488.       fi
  1489.  
  1490.       if test -n "$deplibs"; then
  1491.     $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1492.       fi
  1493.  
  1494.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1495.     $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1496.       fi
  1497.  
  1498.       if test -n "$rpath"; then
  1499.     $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1500.       fi
  1501.  
  1502.       if test -n "$xrpath"; then
  1503.     $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1504.       fi
  1505.  
  1506.       if test -n "$vinfo"; then
  1507.     $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1508.       fi
  1509.  
  1510.       if test -n "$release"; then
  1511.     $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1512.       fi
  1513.  
  1514.       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1515.     $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1516.       fi
  1517.  
  1518.       # Now set the variables for building old libraries.
  1519.       build_libtool_libs=no
  1520.       oldlibs="$output"
  1521.       ;;
  1522.  
  1523.     *.la)
  1524.       # Make sure we only generate libraries of the form `libNAME.la'.
  1525.       case "$outputname" in
  1526.       lib*)
  1527.     name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1528.     eval libname=\"$libname_spec\"
  1529.     ;;
  1530.       *)
  1531.     if test "$module" = no; then
  1532.       $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1533.       $echo "$help" 1>&2
  1534.       exit 1
  1535.     fi
  1536.     if test "$need_lib_prefix" != no; then
  1537.       # Add the "lib" prefix for modules if required
  1538.       name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1539.       eval libname=\"$libname_spec\"
  1540.     else
  1541.       libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1542.     fi
  1543.     ;;
  1544.       esac
  1545.  
  1546.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1547.       if test "X$output_objdir" = "X$output"; then
  1548.     output_objdir="$objdir"
  1549.       else
  1550.     output_objdir="$output_objdir/$objdir"
  1551.       fi
  1552.  
  1553.       if test -n "$objs"; then
  1554.     $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1555.     exit 1
  1556.       fi
  1557.  
  1558.       # How the heck are we supposed to write a wrapper for a shared library?
  1559.       if test -n "$link_against_libtool_libs"; then
  1560.      $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1561.      exit 1
  1562.       fi
  1563.  
  1564.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1565.     $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1566.       fi
  1567.  
  1568.       set dummy $rpath
  1569.       if test $# -gt 2; then
  1570.     $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1571.       fi
  1572.       install_libdir="$2"
  1573.  
  1574.       oldlibs=
  1575.       if test -z "$rpath"; then
  1576.     if test "$build_libtool_libs" = yes; then
  1577.       # Building a libtool convenience library.
  1578.       libext=al
  1579.       oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1580.       build_libtool_libs=convenience
  1581.       build_old_libs=yes
  1582.     fi
  1583.     dependency_libs="$deplibs"
  1584.  
  1585.     if test -n "$vinfo"; then
  1586.       $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1587.     fi
  1588.  
  1589.     if test -n "$release"; then
  1590.       $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1591.     fi
  1592.       else
  1593.  
  1594.     # Parse the version information argument.
  1595.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
  1596.     set dummy $vinfo 0 0 0
  1597.     IFS="$save_ifs"
  1598.  
  1599.     if test -n "$8"; then
  1600.       $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1601.       $echo "$help" 1>&2
  1602.       exit 1
  1603.     fi
  1604.  
  1605.     current="$2"
  1606.     revision="$3"
  1607.     age="$4"
  1608.  
  1609.     # Check that each of the things are valid numbers.
  1610.     case "$current" in
  1611.     0 | [1-9] | [1-9][0-9]*) ;;
  1612.     *)
  1613.       $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1614.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1615.       exit 1
  1616.       ;;
  1617.     esac
  1618.  
  1619.     case "$revision" in
  1620.     0 | [1-9] | [1-9][0-9]*) ;;
  1621.     *)
  1622.       $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1623.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1624.       exit 1
  1625.       ;;
  1626.     esac
  1627.  
  1628.     case "$age" in
  1629.     0 | [1-9] | [1-9][0-9]*) ;;
  1630.     *)
  1631.       $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1632.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1633.       exit 1
  1634.       ;;
  1635.     esac
  1636.  
  1637.     if test $age -gt $current; then
  1638.       $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1639.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1640.       exit 1
  1641.     fi
  1642.  
  1643.     # Calculate the version variables.
  1644.     major=
  1645.     versuffix=
  1646.     verstring=
  1647.     case "$version_type" in
  1648.     none) ;;
  1649.  
  1650.     irix)
  1651.       major=`expr $current - $age + 1`
  1652.       versuffix="$major.$revision"
  1653.       verstring="sgi$major.$revision"
  1654.  
  1655.       # Add in all the interfaces that we are compatible with.
  1656.       loop=$revision
  1657.       while test $loop != 0; do
  1658.         iface=`expr $revision - $loop`
  1659.         loop=`expr $loop - 1`
  1660.         verstring="sgi$major.$iface:$verstring"
  1661.       done
  1662.       ;;
  1663.  
  1664.     linux)
  1665.       major=.`expr $current - $age`
  1666.       versuffix="$major.$age.$revision"
  1667.       ;;
  1668.  
  1669.     osf)
  1670.       major=`expr $current - $age`
  1671.       versuffix=".$current.$age.$revision"
  1672.       verstring="$current.$age.$revision"
  1673.  
  1674.       # Add in all the interfaces that we are compatible with.
  1675.       loop=$age
  1676.       while test $loop != 0; do
  1677.         iface=`expr $current - $loop`
  1678.         loop=`expr $loop - 1`
  1679.         verstring="$verstring:${iface}.0"
  1680.       done
  1681.  
  1682.       # Make executables depend on our current version.
  1683.       verstring="$verstring:${current}.0"
  1684.       ;;
  1685.  
  1686.     sunos)
  1687.       major=".$current"
  1688.       versuffix=".$current.$revision"
  1689.       ;;
  1690.  
  1691.     freebsd-aout)
  1692.       major=".$current"
  1693.       versuffix=".$current.$revision";
  1694.       ;;
  1695.  
  1696.     freebsd-elf)
  1697.       major=".$current"
  1698.       versuffix=".$current";
  1699.       ;;
  1700.  
  1701.     windows)
  1702.       # Like Linux, but with '-' rather than '.', since we only
  1703.       # want one extension on Windows 95.
  1704.       major=`expr $current - $age`
  1705.       versuffix="-$major-$age-$revision"
  1706.       ;;
  1707.  
  1708.     *)
  1709.       $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1710.       echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1711.       exit 1
  1712.       ;;
  1713.     esac
  1714.  
  1715.     # Clear the version info if we defaulted, and they specified a release.
  1716.     if test -z "$vinfo" && test -n "$release"; then
  1717.       major=
  1718.       verstring="0.0"
  1719.       if test "$need_version" = no; then
  1720.         versuffix=
  1721.       else
  1722.         versuffix=".0.0"
  1723.       fi
  1724.     fi
  1725.  
  1726.     # Remove version info from name if versioning should be avoided
  1727.     if test "$avoid_version" = yes && test "$need_version" = no; then
  1728.       major=
  1729.       versuffix=
  1730.       verstring=""
  1731.     fi
  1732.     
  1733.     # Check to see if the archive will have undefined symbols.
  1734.     if test "$allow_undefined" = yes; then
  1735.       if test "$allow_undefined_flag" = unsupported; then
  1736.         $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1737.         build_libtool_libs=no
  1738.         build_old_libs=yes
  1739.       fi
  1740.     else
  1741.       # Don't allow undefined symbols.
  1742.       allow_undefined_flag="$no_undefined_flag"
  1743.     fi
  1744.  
  1745.     dependency_libs="$deplibs"
  1746.     case "$host" in
  1747.     *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1748.       # these systems don't actually have a c library (as such)!
  1749.       ;;
  1750.     *)
  1751.       # Add libc to deplibs on all other systems.
  1752.       deplibs="$deplibs -lc"
  1753.       ;;
  1754.     esac
  1755.       fi
  1756.  
  1757.       # Create the output directory, or remove our outputs if we need to.
  1758.       if test -d $output_objdir; then
  1759.     $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1760.     $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1761.       else
  1762.     $show "$mkdir $output_objdir"
  1763.     $run $mkdir $output_objdir
  1764.     status=$?
  1765.     if test $status -ne 0 && test ! -d $output_objdir; then
  1766.       exit $status
  1767.     fi
  1768.       fi
  1769.  
  1770.       # Now set the variables for building old libraries.
  1771.       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1772.     oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1773.  
  1774.     # Transform .lo files to .o files.
  1775.     oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1776.       fi
  1777.  
  1778.       if test "$build_libtool_libs" = yes; then
  1779.     # Transform deplibs into only deplibs that can be linked in shared.
  1780.     name_save=$name
  1781.     libname_save=$libname
  1782.     release_save=$release
  1783.     versuffix_save=$versuffix
  1784.     major_save=$major
  1785.     # I'm not sure if I'm treating the release correctly.  I think
  1786.     # release should show up in the -l (ie -lgmp5) so we don't want to
  1787.     # add it in twice.  Is that correct?
  1788.     release=""
  1789.     versuffix=""
  1790.     major=""
  1791.     newdeplibs=
  1792.     droppeddeps=no
  1793.     case "$deplibs_check_method" in
  1794.     pass_all)
  1795.       # Don't check for shared/static.  Everything works.
  1796.       # This might be a little naive.  We might want to check
  1797.       # whether the library exists or not.  But this is on
  1798.       # osf3 & osf4 and I'm not really sure... Just
  1799.       # implementing what was already the behaviour.
  1800.       newdeplibs=$deplibs
  1801.       ;;
  1802.     test_compile)
  1803.       # This code stresses the "libraries are programs" paradigm to its
  1804.       # limits. Maybe even breaks it.  We compile a program, linking it
  1805.       # against the deplibs as a proxy for the library.  Then we can check
  1806.       # whether they linked in statically or dynamically with ldd.
  1807.       $rm conftest.c
  1808.       cat > conftest.c <<EOF
  1809.       int main() { return 0; }
  1810. EOF
  1811.       $rm conftest
  1812.       $C_compiler -o conftest conftest.c $deplibs
  1813.       if test $? -eq 0 ; then
  1814.         ldd_output=`ldd conftest`
  1815.         for i in $deplibs; do
  1816.           name="`expr $i : '-l\(.*\)'`"
  1817.           # If $name is empty we are operating on a -L argument.
  1818.           if test "$name" != "" ; then
  1819.         libname=`eval \\$echo \"$libname_spec\"`
  1820.         deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1821.         set dummy $deplib_matches
  1822.         deplib_match=$2
  1823.         if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1824.           newdeplibs="$newdeplibs $i"
  1825.         else
  1826.           droppeddeps=yes
  1827.           echo
  1828.           echo "*** Warning: This library needs some functionality provided by $i."
  1829.           echo "*** I have the capability to make that library automatically link in when"
  1830.           echo "*** you link to this library.  But I can only do this if you have a"
  1831.           echo "*** shared version of the library, which you do not appear to have."
  1832.         fi
  1833.           else
  1834.         newdeplibs="$newdeplibs $i"
  1835.           fi
  1836.         done
  1837.       else
  1838.         # Error occured in the first compile.  Let's try to salvage the situation:
  1839.         # Compile a seperate program for each library.
  1840.         for i in $deplibs; do
  1841.           name="`expr $i : '-l\(.*\)'`"
  1842.          # If $name is empty we are operating on a -L argument.
  1843.           if test "$name" != "" ; then
  1844.         $rm conftest
  1845.         $C_compiler -o conftest conftest.c $i
  1846.         # Did it work?
  1847.         if test $? -eq 0 ; then
  1848.           ldd_output=`ldd conftest`
  1849.           libname=`eval \\$echo \"$libname_spec\"`
  1850.           deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1851.           set dummy $deplib_matches
  1852.           deplib_match=$2
  1853.           if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1854.             newdeplibs="$newdeplibs $i"
  1855.           else
  1856.             droppeddeps=yes
  1857.             echo
  1858.             echo "*** Warning: This library needs some functionality provided by $i."
  1859.             echo "*** I have the capability to make that library automatically link in when"
  1860.             echo "*** you link to this library.  But I can only do this if you have a"
  1861.             echo "*** shared version of the library, which you do not appear to have."
  1862.           fi
  1863.         else
  1864.           droppeddeps=yes
  1865.           echo
  1866.           echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1867.           echo "***  make it link in!  You will probably need to install it or some"
  1868.           echo "*** library that it depends on before this library will be fully"
  1869.           echo "*** functional.  Installing it before continuing would be even better."
  1870.         fi
  1871.           else
  1872.         newdeplibs="$newdeplibs $i"
  1873.           fi
  1874.         done
  1875.       fi
  1876.       ;;
  1877.     file_magic*)
  1878.       set dummy $deplibs_check_method
  1879.       file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1880.       for a_deplib in $deplibs; do
  1881.         name="`expr $a_deplib : '-l\(.*\)'`"
  1882.         # If $name is empty we are operating on a -L argument.
  1883.         if test "$name" != "" ; then
  1884.           libname=`eval \\$echo \"$libname_spec\"`
  1885.           for i in $lib_search_path; do
  1886.             potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1887.             for potent_lib in $potential_libs; do
  1888.               # Follow soft links.
  1889.               if ls -lLd "$potent_lib" 2>/dev/null \
  1890.              | grep " -> " >/dev/null; then
  1891.             continue 
  1892.               fi
  1893.               # The statement above tries to avoid entering an
  1894.               # endless loop below, in case of cyclic links.
  1895.               # We might still enter an endless loop, since a link
  1896.               # loop can be closed while we follow links,
  1897.               # but so what?
  1898.               potlib="$potent_lib"
  1899.               while test -h "$potlib" 2>/dev/null; do
  1900.             potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  1901.             case "$potliblink" in
  1902.             [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  1903.             *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1904.             esac
  1905.               done
  1906.               if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  1907.              | sed 10q \
  1908.              | egrep "$file_magic_regex" > /dev/null; then
  1909.             newdeplibs="$newdeplibs $a_deplib"
  1910.             a_deplib=""
  1911.             break 2
  1912.               fi
  1913.             done
  1914.           done
  1915.           if test -n "$a_deplib" ; then
  1916.         droppeddeps=yes
  1917.         echo
  1918.         echo "*** Warning: This library needs some functionality provided by $a_deplib."
  1919.         echo "*** I have the capability to make that library automatically link in when"
  1920.         echo "*** you link to this library.  But I can only do this if you have a"
  1921.         echo "*** shared version of the library, which you do not appear to have."
  1922.           fi
  1923.         else
  1924.           # Add a -L argument.
  1925.           newdeplibs="$newdeplibs $a_deplib"
  1926.         fi
  1927.       done # Gone through all deplibs.
  1928.       ;;
  1929.     none | unknown | *)
  1930.       newdeplibs=""
  1931.       if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1932.            -e 's/ -[LR][^ ]*//g' -e 's/[     ]//g' |
  1933.          grep . >/dev/null; then
  1934.         echo
  1935.         if test "X$deplibs_check_method" = "Xnone"; then
  1936.           echo "*** Warning: inter-library dependencies are not supported in this platform."
  1937.         else
  1938.           echo "*** Warning: inter-library dependencies are not known to be supported."
  1939.         fi
  1940.         echo "*** All declared inter-library dependencies are being dropped."
  1941.         droppeddeps=yes
  1942.       fi
  1943.       ;;
  1944.     esac
  1945.     versuffix=$versuffix_save
  1946.     major=$major_save
  1947.     release=$release_save
  1948.     libname=$libname_save
  1949.     name=$name_save
  1950.  
  1951.     if test "$droppeddeps" = yes; then
  1952.       if test "$module" = yes; then
  1953.         echo
  1954.         echo "*** Warning: libtool could not satisfy all declared inter-library"
  1955.         echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1956.         echo "*** a static module, that should work as long as the dlopening"
  1957.         echo "*** application is linked with the -dlopen flag."
  1958.         if test -z "$global_symbol_pipe"; then
  1959.           echo
  1960.           echo "*** However, this would only work if libtool was able to extract symbol"
  1961.           echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1962.           echo "*** not find such a program.  So, this module is probably useless."
  1963.           echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1964.         fi
  1965.         if test "$build_old_libs" = no; then
  1966.           oldlibs="$output_objdir/$libname.$libext"
  1967.           build_libtool_libs=module
  1968.           build_old_libs=yes
  1969.         else
  1970.           build_libtool_libs=no
  1971.         fi
  1972.       else
  1973.         echo "*** The inter-library dependencies that have been dropped here will be"
  1974.         echo "*** automatically added whenever a program is linked with this library"
  1975.         echo "*** or is declared to -dlopen it."
  1976.       fi
  1977.     fi
  1978.     # Done checking deplibs!
  1979.     deplibs=$newdeplibs
  1980.       fi
  1981.  
  1982.       # All the library-specific variables (install_libdir is set above).
  1983.       library_names=
  1984.       old_library=
  1985.       dlname=
  1986.       
  1987.       # Test again, we may have decided not to build it any more
  1988.       if test "$build_libtool_libs" = yes; then
  1989.     # Get the real and link names of the library.
  1990.     eval library_names=\"$library_names_spec\"
  1991.     set dummy $library_names
  1992.     realname="$2"
  1993.     shift; shift
  1994.  
  1995.     if test -n "$soname_spec"; then
  1996.       eval soname=\"$soname_spec\"
  1997.     else
  1998.       soname="$realname"
  1999.     fi
  2000.  
  2001.     lib="$output_objdir/$realname"
  2002.     for link
  2003.     do
  2004.       linknames="$linknames $link"
  2005.     done
  2006.  
  2007.     # Ensure that we have .o objects for linkers which dislike .lo
  2008.     # (e.g. aix) incase we are running --disable-static
  2009.     for obj in $libobjs; do
  2010.       oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
  2011.       if test ! -f $oldobj; then
  2012.         $show "${LN_S} $obj $oldobj"
  2013.         $run ${LN_S} $obj $oldobj || exit $?
  2014.       fi
  2015.     done
  2016.  
  2017.     # Use standard objects if they are pic
  2018.     test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2019.  
  2020.     if test -n "$whole_archive_flag_spec"; then
  2021.       if test -n "$convenience"; then
  2022.         eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  2023.       fi
  2024.     else
  2025.       gentop="$output_objdir/${outputname}x"
  2026.       $show "${rm}r $gentop"
  2027.       $run ${rm}r "$gentop"
  2028.       $show "mkdir $gentop"
  2029.       $run mkdir "$gentop"
  2030.       status=$?
  2031.       if test $status -ne 0 && test ! -d "$gentop"; then
  2032.         exit $status
  2033.       fi
  2034.       generated="$generated $gentop"
  2035.       
  2036.       for xlib in $convenience; do
  2037.         # Extract the objects.
  2038.         case "$xlib" in
  2039.         [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2040.         *) xabs=`pwd`"/$xlib" ;;
  2041.         esac
  2042.         xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2043.         xdir="$gentop/$xlib"
  2044.  
  2045.         $show "${rm}r $xdir"
  2046.         $run ${rm}r "$xdir"
  2047.         $show "mkdir $xdir"
  2048.         $run mkdir "$xdir"
  2049.         status=$?
  2050.         if test $status -ne 0 && test ! -d "$xdir"; then
  2051.           exit $status
  2052.         fi
  2053.         $show "(cd $xdir && $AR x $xabs)"
  2054.         $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2055.  
  2056.         libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2057.       done
  2058.     fi
  2059.  
  2060.     if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  2061.       eval flag=\"$thread_safe_flag_spec\"
  2062.       linkopts="$linkopts $flag"
  2063.     fi
  2064.  
  2065.     # Prepare the list of exported symbols
  2066.     if test -z "$export_symbols"; then
  2067.       if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  2068.         $show "generating symbol list for \`$libname.la'"
  2069.         export_symbols="$output_objdir/$libname.exp"
  2070.         $run $rm $export_symbols
  2071.         eval cmds=\"$export_symbols_cmds\"
  2072.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2073.         for cmd in $cmds; do
  2074.           IFS="$save_ifs"
  2075.           $show "$cmd"
  2076.           $run eval "$cmd" || exit $?
  2077.         done
  2078.         IFS="$save_ifs"
  2079.         if test -n "$export_symbols_regex"; then
  2080.           $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  2081.           $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  2082.           $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  2083.           $run eval '$mv "${export_symbols}T" "$export_symbols"'
  2084.         fi
  2085.       fi
  2086.     fi
  2087.  
  2088.     if test -n "$export_symbols" && test -n "$include_expsyms"; then
  2089.       $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  2090.     fi
  2091.  
  2092.     # Do each of the archive commands.
  2093.     if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  2094.       eval cmds=\"$archive_expsym_cmds\"
  2095.     else
  2096.       eval cmds=\"$archive_cmds\"
  2097.     fi
  2098.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2099.     for cmd in $cmds; do
  2100.       IFS="$save_ifs"
  2101.       $show "$cmd"
  2102.       $run eval "$cmd" || exit $?
  2103.     done
  2104.     IFS="$save_ifs"
  2105.  
  2106.     # Create links to the real library.
  2107.     for linkname in $linknames; do
  2108.       if test "$realname" != "$linkname"; then
  2109.         $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  2110.         $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  2111.       fi
  2112.     done
  2113.  
  2114.     # If -module or -export-dynamic was specified, set the dlname.
  2115.     if test "$module" = yes || test "$export_dynamic" = yes; then
  2116.       # On all known operating systems, these are identical.
  2117.       dlname="$soname"
  2118.     fi
  2119.       fi
  2120.       ;;
  2121.  
  2122.     *.lo | *.o | *.obj)
  2123.       if test -n "$link_against_libtool_libs"; then
  2124.     $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  2125.     exit 1
  2126.       fi
  2127.  
  2128.       if test -n "$deplibs"; then
  2129.     $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  2130.       fi
  2131.  
  2132.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2133.     $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  2134.       fi
  2135.  
  2136.       if test -n "$rpath"; then
  2137.     $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  2138.       fi
  2139.  
  2140.       if test -n "$xrpath"; then
  2141.     $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  2142.       fi
  2143.  
  2144.       if test -n "$vinfo"; then
  2145.     $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  2146.       fi
  2147.  
  2148.       if test -n "$release"; then
  2149.     $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  2150.       fi
  2151.  
  2152.       case "$output" in
  2153.       *.lo)
  2154.     if test -n "$objs"; then
  2155.       $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2156.       exit 1
  2157.     fi
  2158.     libobj="$output"
  2159.     obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2160.     ;;
  2161.       *)
  2162.     libobj=
  2163.     obj="$output"
  2164.     ;;
  2165.       esac
  2166.  
  2167.       # Delete the old objects.
  2168.       $run $rm $obj $libobj
  2169.  
  2170.       # Create the old-style object.
  2171.       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  2172.  
  2173.       output="$obj"
  2174.       eval cmds=\"$reload_cmds\"
  2175.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2176.       for cmd in $cmds; do
  2177.     IFS="$save_ifs"
  2178.     $show "$cmd"
  2179.     $run eval "$cmd" || exit $?
  2180.       done
  2181.       IFS="$save_ifs"
  2182.  
  2183.       # Exit if we aren't doing a library object file.
  2184.       test -z "$libobj" && exit 0
  2185.  
  2186.       if test "$build_libtool_libs" != yes; then
  2187.     # Create an invalid libtool object if no PIC, so that we don't
  2188.     # accidentally link it into a program.
  2189.     $show "echo timestamp > $libobj"
  2190.     $run eval "echo timestamp > $libobj" || exit $?
  2191.     exit 0
  2192.       fi
  2193.  
  2194.       if test -n "$pic_flag"; then
  2195.     # Only do commands if we really have different PIC objects.
  2196.     reload_objs="$libobjs"
  2197.     output="$libobj"
  2198.     eval cmds=\"$reload_cmds\"
  2199.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2200.     for cmd in $cmds; do
  2201.       IFS="$save_ifs"
  2202.       $show "$cmd"
  2203.       $run eval "$cmd" || exit $?
  2204.     done
  2205.     IFS="$save_ifs"
  2206.       else
  2207.     # Just create a symlink.
  2208.     $show $rm $libobj
  2209.     $run $rm $libobj
  2210.     $show "$LN_S $obj $libobj"
  2211.     $run $LN_S $obj $libobj || exit $?
  2212.       fi
  2213.  
  2214.       exit 0
  2215.       ;;
  2216.  
  2217.     # Anything else should be a program.
  2218.     *)
  2219.       if test -n "$vinfo"; then
  2220.     $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2221.       fi
  2222.  
  2223.       if test -n "$release"; then
  2224.     $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2225.       fi
  2226.  
  2227.       if test "$preload" = yes; then
  2228.     if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  2229.        test "$dlopen_self_static" = unknown; then
  2230.       $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2231.     fi 
  2232.       fi
  2233.     
  2234.       if test -n "$rpath$xrpath"; then
  2235.     # If the user specified any rpath flags, then add them.
  2236.     for libdir in $rpath $xrpath; do
  2237.       # This is the magic to use -rpath.
  2238.       case "$compile_rpath " in
  2239.       *" $libdir "*) ;;
  2240.       *) compile_rpath="$compile_rpath $libdir" ;;
  2241.       esac
  2242.       case "$finalize_rpath " in
  2243.       *" $libdir "*) ;;
  2244.       *) finalize_rpath="$finalize_rpath $libdir" ;;
  2245.       esac
  2246.     done
  2247.       fi
  2248.  
  2249.       # Now hardcode the library paths
  2250.       rpath=
  2251.       hardcode_libdirs=
  2252.       for libdir in $compile_rpath $finalize_rpath; do
  2253.     if test -n "$hardcode_libdir_flag_spec"; then
  2254.       if test -n "$hardcode_libdir_separator"; then
  2255.         if test -z "$hardcode_libdirs"; then
  2256.           hardcode_libdirs="$libdir"
  2257.         else
  2258.           # Just accumulate the unique libdirs.
  2259.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2260.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2261.         ;;
  2262.           *)
  2263.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2264.         ;;
  2265.           esac
  2266.         fi
  2267.       else
  2268.         eval flag=\"$hardcode_libdir_flag_spec\"
  2269.         rpath="$rpath $flag"
  2270.       fi
  2271.     elif test -n "$runpath_var"; then
  2272.       case "$perm_rpath " in
  2273.       *" $libdir "*) ;;
  2274.       *) perm_rpath="$perm_rpath $libdir" ;;
  2275.       esac
  2276.     fi
  2277.       done
  2278.       # Substitute the hardcoded libdirs into the rpath.
  2279.       if test -n "$hardcode_libdir_separator" &&
  2280.      test -n "$hardcode_libdirs"; then
  2281.     libdir="$hardcode_libdirs"
  2282.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2283.       fi
  2284.       compile_rpath="$rpath"
  2285.  
  2286.       rpath=
  2287.       hardcode_libdirs=
  2288.       for libdir in $finalize_rpath; do
  2289.     if test -n "$hardcode_libdir_flag_spec"; then
  2290.       if test -n "$hardcode_libdir_separator"; then
  2291.         if test -z "$hardcode_libdirs"; then
  2292.           hardcode_libdirs="$libdir"
  2293.         else
  2294.           # Just accumulate the unique libdirs.
  2295.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2296.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2297.         ;;
  2298.           *)
  2299.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2300.         ;;
  2301.           esac
  2302.         fi
  2303.       else
  2304.         eval flag=\"$hardcode_libdir_flag_spec\"
  2305.         rpath="$rpath $flag"
  2306.       fi
  2307.     elif test -n "$runpath_var"; then
  2308.       case "$finalize_perm_rpath " in
  2309.       *" $libdir "*) ;;
  2310.       *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2311.       esac
  2312.     fi
  2313.       done
  2314.       # Substitute the hardcoded libdirs into the rpath.
  2315.       if test -n "$hardcode_libdir_separator" &&
  2316.      test -n "$hardcode_libdirs"; then
  2317.     libdir="$hardcode_libdirs"
  2318.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2319.       fi
  2320.       finalize_rpath="$rpath"
  2321.  
  2322.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  2323.       if test "X$output_objdir" = "X$output"; then
  2324.     output_objdir="$objdir"
  2325.       else
  2326.     output_objdir="$output_objdir/$objdir"
  2327.       fi
  2328.  
  2329.       # Create the binary in the object directory, then wrap it.
  2330.       if test ! -d $output_objdir; then
  2331.     $show "$mkdir $output_objdir"
  2332.     $run $mkdir $output_objdir
  2333.     status=$?
  2334.     if test $status -ne 0 && test ! -d $output_objdir; then
  2335.       exit $status
  2336.     fi
  2337.       fi
  2338.  
  2339.       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  2340.     # Transform all the library objects into standard objects.
  2341.     compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2342.     finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2343.       fi
  2344.  
  2345.       dlsyms=
  2346.       if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
  2347.     if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2348.       dlsyms="${outputname}S.c"
  2349.     else
  2350.       $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  2351.     fi
  2352.       fi
  2353.  
  2354.       if test -n "$dlsyms"; then
  2355.     case "$dlsyms" in
  2356.     "") ;;
  2357.     *.c)
  2358.       # Discover the nlist of each of the dlfiles.
  2359.       nlist="$output_objdir/${outputname}.nm"
  2360.  
  2361.       $show "$rm $nlist ${nlist}S ${nlist}T"
  2362.       $run $rm "$nlist" "${nlist}S" "${nlist}T"
  2363.  
  2364.       # Parse the name list into a source file.
  2365.       $show "creating $output_objdir/$dlsyms"
  2366.  
  2367.       test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  2368. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  2369. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  2370.  
  2371. #ifdef __cplusplus
  2372. extern \"C\" {
  2373. #endif
  2374.  
  2375. /* Prevent the only kind of declaration conflicts we can make. */
  2376. #define lt_preloaded_symbols some_other_symbol
  2377.  
  2378. /* External symbol declarations for the compiler. */\
  2379. "
  2380.  
  2381.       if test "$dlself" = yes; then
  2382.         $show "generating symbol list for \`$output'"
  2383.  
  2384.         test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  2385.  
  2386.         # Add our own program objects to the symbol list.
  2387.         progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2388.         for arg in $progfiles; do
  2389.           $show "extracting global C symbols from \`$arg'"
  2390.           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2391.         done
  2392.  
  2393.         if test -n "$exclude_expsyms"; then
  2394.           $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2395.           $run eval '$mv "$nlist"T "$nlist"'
  2396.         fi
  2397.         
  2398.         if test -n "$export_symbols_regex"; then
  2399.           $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2400.           $run eval '$mv "$nlist"T "$nlist"'
  2401.         fi
  2402.  
  2403.         # Prepare the list of exported symbols
  2404.         if test -z "$export_symbols"; then
  2405.           export_symbols="$output_objdir/$output.exp"
  2406.           $run $rm $export_symbols
  2407.           $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2408.         else
  2409.           $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  2410.           $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  2411.           $run eval 'mv "$nlist"T "$nlist"'
  2412.         fi
  2413.       fi
  2414.  
  2415.       for arg in $dlprefiles; do
  2416.         $show "extracting global C symbols from \`$arg'"
  2417.         name=`echo "$arg" | sed -e 's%^.*/%%'`
  2418.         $run eval 'echo ": $name " >> "$nlist"'
  2419.         $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2420.       done
  2421.  
  2422.       if test -z "$run"; then
  2423.         # Make sure we have at least an empty file.
  2424.         test -f "$nlist" || : > "$nlist"
  2425.  
  2426.         if test -n "$exclude_expsyms"; then
  2427.           egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2428.           $mv "$nlist"T "$nlist"
  2429.         fi
  2430.  
  2431.         # Try sorting and uniquifying the output.
  2432.         if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  2433.           :
  2434.         else
  2435.           grep -v "^: " < "$nlist" > "$nlist"S
  2436.         fi
  2437.  
  2438.         if test -f "$nlist"S; then
  2439.           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  2440.         else
  2441.           echo '/* NONE */' >> "$output_objdir/$dlsyms"
  2442.         fi
  2443.  
  2444.         $echo >> "$output_objdir/$dlsyms" "\
  2445.  
  2446. #undef lt_preloaded_symbols
  2447.  
  2448. #if defined (__STDC__) && __STDC__
  2449. # define lt_ptr_t void *
  2450. #else
  2451. # define lt_ptr_t char *
  2452. # define const
  2453. #endif
  2454.  
  2455. /* The mapping between symbol names and symbols. */
  2456. const struct {
  2457.   const char *name;
  2458.   lt_ptr_t address;
  2459. }
  2460. lt_preloaded_symbols[] =
  2461. {\
  2462. "
  2463.  
  2464.         sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  2465.         -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  2466.           < "$nlist" >> "$output_objdir/$dlsyms"
  2467.  
  2468.         $echo >> "$output_objdir/$dlsyms" "\
  2469.   {0, (lt_ptr_t) 0}
  2470. };
  2471.  
  2472. /* This works around a problem in FreeBSD linker */
  2473. #ifdef FREEBSD_WORKAROUND
  2474. static const void *lt_preloaded_setup() {
  2475.   return lt_preloaded_symbols;
  2476. }
  2477. #endif
  2478.  
  2479. #ifdef __cplusplus
  2480. }
  2481. #endif\
  2482. "
  2483.       fi
  2484.  
  2485.       pic_flag_for_symtable=
  2486.       case "$host" in
  2487.       # compiling the symbol table file with pic_flag works around
  2488.       # a FreeBSD bug that causes programs to crash when -lm is
  2489.       # linked before any other PIC object.  But we must not use
  2490.       # pic_flag when linking with -static.  The problem exists in
  2491.       # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2492.       *-*-freebsd2*|*-*-freebsd3.0*)
  2493.         case "$compile_command " in
  2494.         *" -static "*) ;;
  2495.         *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  2496.         esac
  2497.       esac
  2498.  
  2499.       # Now compile the dynamic symbol file.
  2500.       $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  2501.       $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  2502.  
  2503.       # Clean up the generated files.
  2504.       $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  2505.       $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  2506.  
  2507.       # Transform the symbol file into the correct name.
  2508.       compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2509.       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2510.       ;;
  2511.     *)
  2512.       $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  2513.       exit 1
  2514.       ;;
  2515.     esac
  2516.       else
  2517.     # We keep going just in case the user didn't refer to
  2518.     # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  2519.     # really was required.
  2520.  
  2521.     # Nullify the symbol file.
  2522.     compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2523.     finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2524.       fi
  2525.  
  2526.       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  2527.     # Replace the output file specification.
  2528.     compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  2529.     link_command="$compile_command$compile_rpath"
  2530.  
  2531.     # We have no uninstalled library dependencies, so finalize right now.
  2532.     $show "$link_command"
  2533.     $run eval "$link_command"
  2534.     status=$?
  2535.     
  2536.     # Delete the generated files.
  2537.     if test -n "$dlsyms"; then
  2538.       $show "$rm $output_objdir/${outputname}S.${objext}"
  2539.       $run $rm "$output_objdir/${outputname}S.${objext}"
  2540.     fi
  2541.  
  2542.     exit $status
  2543.       fi
  2544.  
  2545.       if test -n "$shlibpath_var"; then
  2546.     # We should set the shlibpath_var
  2547.     rpath=
  2548.     for dir in $temp_rpath; do
  2549.       case "$dir" in
  2550.       [\\/]* | [A-Za-z]:[\\/]*)
  2551.         # Absolute path.
  2552.         rpath="$rpath$dir:"
  2553.         ;;
  2554.       *)
  2555.         # Relative path: add a thisdir entry.
  2556.         rpath="$rpath\$thisdir/$dir:"
  2557.         ;;
  2558.       esac
  2559.     done
  2560.     temp_rpath="$rpath"
  2561.       fi
  2562.  
  2563.       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  2564.     compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  2565.       fi
  2566.       if test -n "$finalize_shlibpath"; then
  2567.     finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  2568.       fi
  2569.  
  2570.       compile_var=
  2571.       finalize_var=
  2572.       if test -n "$runpath_var"; then
  2573.     if test -n "$perm_rpath"; then
  2574.       # We should set the runpath_var.
  2575.       rpath=
  2576.       for dir in $perm_rpath; do
  2577.         rpath="$rpath$dir:"
  2578.       done
  2579.       compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2580.     fi
  2581.     if test -n "$finalize_perm_rpath"; then
  2582.       # We should set the runpath_var.
  2583.       rpath=
  2584.       for dir in $finalize_perm_rpath; do
  2585.         rpath="$rpath$dir:"
  2586.       done
  2587.       finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2588.     fi
  2589.       fi
  2590.  
  2591.       if test "$hardcode_action" = relink; then
  2592.     # Fast installation is not supported
  2593.     link_command="$compile_var$compile_command$compile_rpath"
  2594.     relink_command="$finalize_var$finalize_command$finalize_rpath"
  2595.     
  2596.     $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  2597.     $echo "$modename: \`$output' will be relinked during installation" 1>&2
  2598.       else
  2599.     if test "$fast_install" != no; then
  2600.       link_command="$finalize_var$compile_command$finalize_rpath"
  2601.       if test "$fast_install" = yes; then
  2602.         relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  2603.       else
  2604.         # fast_install is set to needless
  2605.         relink_command=
  2606.       fi
  2607.     else
  2608.       link_command="$compile_var$compile_command$compile_rpath"
  2609.       relink_command="$finalize_var$finalize_command$finalize_rpath"
  2610.     fi
  2611.       fi
  2612.  
  2613.       # Replace the output file specification.
  2614.       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  2615.       
  2616.       # Delete the old output files.
  2617.       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  2618.  
  2619.       $show "$link_command"
  2620.       $run eval "$link_command" || exit $?
  2621.  
  2622.       # Now create the wrapper script.
  2623.       $show "creating $output"
  2624.  
  2625.       # Quote the relink command for shipping.
  2626.       if test -n "$relink_command"; then
  2627.     relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  2628.       fi
  2629.  
  2630.       # Quote $echo for shipping.
  2631.       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  2632.     case "$0" in
  2633.     [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  2634.     *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  2635.     esac
  2636.     qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  2637.       else
  2638.     qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  2639.       fi
  2640.  
  2641.       # Only actually do things if our run command is non-null.
  2642.       if test -z "$run"; then
  2643.     # win32 will think the script is a binary if it has
  2644.     # a .exe suffix, so we strip it off here.
  2645.     case $output in
  2646.       *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  2647.     esac
  2648.     $rm $output
  2649.     trap "$rm $output; exit 1" 1 2 15
  2650.  
  2651.     $echo > $output "\
  2652. #! $SHELL
  2653.  
  2654. # $output - temporary wrapper script for $objdir/$outputname
  2655. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2656. #
  2657. # The $output program cannot be directly executed until all the libtool
  2658. # libraries that it depends on are installed.
  2659. #
  2660. # This wrapper script should never be moved out of the build directory.
  2661. # If it is, it will not operate correctly.
  2662.  
  2663. # Sed substitution that helps us do robust quoting.  It backslashifies
  2664. # metacharacters that are still active within double-quoted strings.
  2665. Xsed='sed -e 1s/^X//'
  2666. sed_quote_subst='$sed_quote_subst'
  2667.  
  2668. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2669. # if CDPATH is set.
  2670. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
  2671.  
  2672. relink_command=\"$relink_command\"
  2673.  
  2674. # This environment variable determines our operation mode.
  2675. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2676.   # install mode needs the following variable:
  2677.   link_against_libtool_libs='$link_against_libtool_libs'
  2678. else
  2679.   # When we are sourced in execute mode, \$file and \$echo are already set.
  2680.   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2681.     echo=\"$qecho\"
  2682.     file=\"\$0\"
  2683.     # Make sure echo works.
  2684.     if test \"X\$1\" = X--no-reexec; then
  2685.       # Discard the --no-reexec flag, and continue.
  2686.       shift
  2687.     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  2688.       # Yippee, \$echo works!
  2689.       :
  2690.     else
  2691.       # Restart under the correct shell, and then maybe \$echo will work.
  2692.       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2693.     fi
  2694.   fi\
  2695. "
  2696.     $echo >> $output "\
  2697.  
  2698.   # Find the directory that this script lives in.
  2699.   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2700.   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2701.  
  2702.   # Follow symbolic links until we get to the real thisdir.
  2703.   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  2704.   while test -n \"\$file\"; do
  2705.     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2706.  
  2707.     # If there was a directory component, then change thisdir.
  2708.     if test \"x\$destdir\" != \"x\$file\"; then
  2709.       case \"\$destdir\" in
  2710.       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  2711.       *) thisdir=\"\$thisdir/\$destdir\" ;;
  2712.       esac
  2713.     fi
  2714.  
  2715.     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2716.     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  2717.   done
  2718.  
  2719.   # Try to get the absolute directory name.
  2720.   absdir=\`cd \"\$thisdir\" && pwd\`
  2721.   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2722. "
  2723.  
  2724.     if test "$fast_install" = yes; then
  2725.       echo >> $output "\
  2726.   program=lt-'$outputname'
  2727.   progdir=\"\$thisdir/$objdir\"
  2728.   
  2729.   if test ! -f \"\$progdir/\$program\" || \\
  2730.      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  2731.        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2732.  
  2733.     file=\"\$\$-\$program\"
  2734.  
  2735.     if test ! -d \"\$progdir\"; then
  2736.       $mkdir \"\$progdir\"
  2737.     else
  2738.       $rm \"\$progdir/\$file\"
  2739.     fi"
  2740.  
  2741.       echo >> $output "\
  2742.  
  2743.     # relink executable if necessary
  2744.     if test -n \"\$relink_command\"; then
  2745.       if (cd \"\$thisdir\" && eval \$relink_command); then :
  2746.       else
  2747.     $rm \"\$progdir/\$file\"
  2748.     exit 1
  2749.       fi
  2750.     fi
  2751.  
  2752.     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2753.     { $rm \"\$progdir/\$program\";
  2754.       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2755.     $rm \"\$progdir/\$file\"
  2756.   fi"
  2757.     else
  2758.       echo >> $output "\
  2759.   program='$outputname'
  2760.   progdir=\"\$thisdir/$objdir\"
  2761. "
  2762.     fi
  2763.  
  2764.     echo >> $output "\
  2765.  
  2766.   if test -f \"\$progdir/\$program\"; then"
  2767.  
  2768.     # Export our shlibpath_var if we have one.
  2769.     if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2770.       $echo >> $output "\
  2771.     # Add our own library path to $shlibpath_var
  2772.     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2773.  
  2774.     # Some systems cannot cope with colon-terminated $shlibpath_var
  2775.     # The second colon is a workaround for a bug in BeOS R4 sed
  2776.     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2777.  
  2778.     export $shlibpath_var
  2779. "
  2780.     fi
  2781.  
  2782.     # fixup the dll searchpath if we need to.
  2783.     if test -n "$dllsearchpath"; then
  2784.       $echo >> $output "\
  2785.     # Add the dll search path components to the executable PATH
  2786.     PATH=$dllsearchpath:\$PATH
  2787. "
  2788.     fi
  2789.  
  2790.     $echo >> $output "\
  2791.     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2792.       # Run the actual program with our arguments.
  2793. "
  2794.     case $host in
  2795.     *-*-cygwin* | *-*-mingw | *-*-os2*)
  2796.       # win32 systems need to use the prog path for dll
  2797.       # lookup to work
  2798.       $echo >> $output "\
  2799.       exec \$progdir\\\\\$program \${1+\"\$@\"}
  2800. "
  2801.       ;;
  2802.     *)
  2803.       $echo >> $output "\
  2804.       # Export the path to the program.
  2805.       PATH=\"\$progdir:\$PATH\"
  2806.       export PATH
  2807.  
  2808.       exec \$program \${1+\"\$@\"}
  2809. "
  2810.       ;;
  2811.     esac
  2812.     $echo >> $output "\
  2813.       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  2814.       exit 1
  2815.     fi
  2816.   else
  2817.     # The program doesn't exist.
  2818.     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  2819.     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  2820.     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  2821.     exit 1
  2822.   fi
  2823. fi\
  2824. "
  2825.     chmod +x $output
  2826.       fi
  2827.       exit 0
  2828.       ;;
  2829.     esac
  2830.  
  2831.     # See if we need to build an old-fashioned archive.
  2832.     for oldlib in $oldlibs; do
  2833.  
  2834.       if test "$build_libtool_libs" = convenience; then
  2835.     oldobjs="$libobjs_save"
  2836.     addlibs="$convenience"
  2837.     build_libtool_libs=no
  2838.       else
  2839.     if test "$build_libtool_libs" = module; then
  2840.       oldobjs="$libobjs_save"
  2841.       build_libtool_libs=no
  2842.     else
  2843.       oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  2844.     fi
  2845.     addlibs="$old_convenience"
  2846.       fi
  2847.  
  2848.       if test -n "$addlibs"; then
  2849.     gentop="$output_objdir/${outputname}x"
  2850.     $show "${rm}r $gentop"
  2851.     $run ${rm}r "$gentop"
  2852.     $show "mkdir $gentop"
  2853.     $run mkdir "$gentop"
  2854.     status=$?
  2855.     if test $status -ne 0 && test ! -d "$gentop"; then
  2856.       exit $status
  2857.     fi
  2858.     generated="$generated $gentop"
  2859.       
  2860.     # Add in members from convenience archives.
  2861.     for xlib in $addlibs; do
  2862.       # Extract the objects.
  2863.       case "$xlib" in
  2864.       [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2865.       *) xabs=`pwd`"/$xlib" ;;
  2866.       esac
  2867.       xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2868.       xdir="$gentop/$xlib"
  2869.  
  2870.       $show "${rm}r $xdir"
  2871.       $run ${rm}r "$xdir"
  2872.       $show "mkdir $xdir"
  2873.       $run mkdir "$xdir"
  2874.       status=$?
  2875.       if test $status -ne 0 && test ! -d "$xdir"; then
  2876.         exit $status
  2877.       fi
  2878.       $show "(cd $xdir && $AR x $xabs)"
  2879.       $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2880.  
  2881.       oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  2882.     done
  2883.       fi
  2884.  
  2885.       # Do each command in the archive commands.
  2886.       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  2887.     eval cmds=\"$old_archive_from_new_cmds\"
  2888.       else
  2889.     # Ensure that we have .o objects in place incase we decided
  2890.     # not to build a shared library, and have fallen back to building
  2891.     # static libs even though --disable-static was passed!
  2892.     for oldobj in $oldobjs; do
  2893.       if test ! -f $oldobj; then
  2894.         obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"`
  2895.         $show "${LN_S} $obj $oldobj"
  2896.         $run ${LN_S} $obj $oldobj || exit $?
  2897.       fi
  2898.     done
  2899.  
  2900.     eval cmds=\"$old_archive_cmds\"
  2901.       fi
  2902.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2903.       for cmd in $cmds; do
  2904.     IFS="$save_ifs"
  2905.     $show "$cmd"
  2906.     $run eval "$cmd" || exit $?
  2907.       done
  2908.       IFS="$save_ifs"
  2909.     done
  2910.  
  2911.     if test -n "$generated"; then
  2912.       $show "${rm}r$generated"
  2913.       $run ${rm}r$generated
  2914.     fi
  2915.  
  2916.     # Now create the libtool archive.
  2917.     case "$output" in
  2918.     *.la)
  2919.       old_library=
  2920.       test "$build_old_libs" = yes && old_library="$libname.$libext"
  2921.       $show "creating $output"
  2922.  
  2923.       if test -n "$xrpath"; then
  2924.     temp_xrpath=
  2925.     for libdir in $xrpath; do
  2926.       temp_xrpath="$temp_xrpath -R$libdir"
  2927.     done
  2928.     dependency_libs="$temp_xrpath $dependency_libs"
  2929.       fi
  2930.  
  2931.       # Only create the output if not a dry run.
  2932.       if test -z "$run"; then
  2933.     for installed in no yes; do
  2934.       if test "$installed" = yes; then
  2935.         if test -z "$install_libdir"; then
  2936.           break
  2937.         fi
  2938.         output="$output_objdir/$outputname"i
  2939.       fi
  2940.       $rm $output
  2941.       $echo > $output "\
  2942. # $outputname - a libtool library file
  2943. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2944. #
  2945. # Please DO NOT delete this file!
  2946. # It is necessary for linking the library.
  2947.  
  2948. # The name that we can dlopen(3).
  2949. dlname='$dlname'
  2950.  
  2951. # Names of this library.
  2952. library_names='$library_names'
  2953.  
  2954. # The name of the static archive.
  2955. old_library='$old_library'
  2956.  
  2957. # Libraries that this one depends upon.
  2958. dependency_libs='$dependency_libs'
  2959.  
  2960. # Version information for $libname.
  2961. current=$current
  2962. age=$age
  2963. revision=$revision
  2964.  
  2965. # Is this an already installed library?
  2966. installed=$installed
  2967.  
  2968. # Directory that this library needs to be installed in:
  2969. libdir='$install_libdir'\
  2970. "
  2971.     done
  2972.       fi
  2973.  
  2974.       # Do a symbolic link so that the libtool archive can be found in
  2975.       # LD_LIBRARY_PATH before the program is installed.
  2976.       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  2977.       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  2978.       ;;
  2979.     esac
  2980.     exit 0
  2981.     ;;
  2982.  
  2983.   # libtool install mode
  2984.   install)
  2985.     modename="$modename: install"
  2986.  
  2987.     # There may be an optional sh(1) argument at the beginning of
  2988.     # install_prog (especially on Windows NT).
  2989.     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  2990.       # Aesthetically quote it.
  2991.       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  2992.       case "$arg" in
  2993.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  2994.     arg="\"$arg\""
  2995.     ;;
  2996.       esac
  2997.       install_prog="$arg "
  2998.       arg="$1"
  2999.       shift
  3000.     else
  3001.       install_prog=
  3002.       arg="$nonopt"
  3003.     fi
  3004.  
  3005.     # The real first argument should be the name of the installation program.
  3006.     # Aesthetically quote it.
  3007.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3008.     case "$arg" in
  3009.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3010.       arg="\"$arg\""
  3011.       ;;
  3012.     esac
  3013.     install_prog="$install_prog$arg"
  3014.  
  3015.     # We need to accept at least all the BSD install flags.
  3016.     dest=
  3017.     files=
  3018.     opts=
  3019.     prev=
  3020.     install_type=
  3021.     isdir=no
  3022.     stripme=
  3023.     for arg
  3024.     do
  3025.       if test -n "$dest"; then
  3026.     files="$files $dest"
  3027.     dest="$arg"
  3028.     continue
  3029.       fi
  3030.  
  3031.       case "$arg" in
  3032.       -d) isdir=yes ;;
  3033.       -f) prev="-f" ;;
  3034.       -g) prev="-g" ;;
  3035.       -m) prev="-m" ;;
  3036.       -o) prev="-o" ;;
  3037.       -s)
  3038.     stripme=" -s"
  3039.     continue
  3040.     ;;
  3041.       -*) ;;
  3042.  
  3043.       *)
  3044.     # If the previous option needed an argument, then skip it.
  3045.     if test -n "$prev"; then
  3046.       prev=
  3047.     else
  3048.       dest="$arg"
  3049.       continue
  3050.     fi
  3051.     ;;
  3052.       esac
  3053.  
  3054.       # Aesthetically quote the argument.
  3055.       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3056.       case "$arg" in
  3057.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3058.     arg="\"$arg\""
  3059.     ;;
  3060.       esac
  3061.       install_prog="$install_prog $arg"
  3062.     done
  3063.  
  3064.     if test -z "$install_prog"; then
  3065.       $echo "$modename: you must specify an install program" 1>&2
  3066.       $echo "$help" 1>&2
  3067.       exit 1
  3068.     fi
  3069.  
  3070.     if test -n "$prev"; then
  3071.       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  3072.       $echo "$help" 1>&2
  3073.       exit 1
  3074.     fi
  3075.  
  3076.     if test -z "$files"; then
  3077.       if test -z "$dest"; then
  3078.     $echo "$modename: no file or destination specified" 1>&2
  3079.       else
  3080.     $echo "$modename: you must specify a destination" 1>&2
  3081.       fi
  3082.       $echo "$help" 1>&2
  3083.       exit 1
  3084.     fi
  3085.  
  3086.     # Strip any trailing slash from the destination.
  3087.     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  3088.  
  3089.     # Check to see that the destination is a directory.
  3090.     test -d "$dest" && isdir=yes
  3091.     if test "$isdir" = yes; then
  3092.       destdir="$dest"
  3093.       destname=
  3094.     else
  3095.       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  3096.       test "X$destdir" = "X$dest" && destdir=.
  3097.       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  3098.  
  3099.       # Not a directory, so check to see that there is only one file specified.
  3100.       set dummy $files
  3101.       if test $# -gt 2; then
  3102.     $echo "$modename: \`$dest' is not a directory" 1>&2
  3103.     $echo "$help" 1>&2
  3104.     exit 1
  3105.       fi
  3106.     fi
  3107.     case "$destdir" in
  3108.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  3109.     *)
  3110.       for file in $files; do
  3111.     case "$file" in
  3112.     *.lo) ;;
  3113.     *)
  3114.       $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  3115.       $echo "$help" 1>&2
  3116.       exit 1
  3117.       ;;
  3118.     esac
  3119.       done
  3120.       ;;
  3121.     esac
  3122.  
  3123.     # This variable tells wrapper scripts just to set variables rather
  3124.     # than running their programs.
  3125.     libtool_install_magic="$magic"
  3126.  
  3127.     staticlibs=
  3128.     future_libdirs=
  3129.     current_libdirs=
  3130.     for file in $files; do
  3131.  
  3132.       # Do each installation.
  3133.       case "$file" in
  3134.       *.a | *.lib)
  3135.     # Do the static libraries later.
  3136.     staticlibs="$staticlibs $file"
  3137.     ;;
  3138.  
  3139.       *.la)
  3140.     # Check to see that this really is a libtool archive.
  3141.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3142.     else
  3143.       $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  3144.       $echo "$help" 1>&2
  3145.       exit 1
  3146.     fi
  3147.  
  3148.     library_names=
  3149.     old_library=
  3150.     # If there is no directory component, then add one.
  3151.     case "$file" in
  3152.     */* | *\\*) . $file ;;
  3153.     *) . ./$file ;;
  3154.     esac
  3155.  
  3156.     # Add the libdir to current_libdirs if it is the destination.
  3157.     if test "X$destdir" = "X$libdir"; then
  3158.       case "$current_libdirs " in
  3159.       *" $libdir "*) ;;
  3160.       *) current_libdirs="$current_libdirs $libdir" ;;
  3161.       esac
  3162.     else
  3163.       # Note the libdir as a future libdir.
  3164.       case "$future_libdirs " in
  3165.       *" $libdir "*) ;;
  3166.       *) future_libdirs="$future_libdirs $libdir" ;;
  3167.       esac
  3168.     fi
  3169.  
  3170.     dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  3171.     test "X$dir" = "X$file/" && dir=
  3172.     dir="$dir$objdir"
  3173.  
  3174.     # See the names of the shared library.
  3175.     set dummy $library_names
  3176.     if test -n "$2"; then
  3177.       realname="$2"
  3178.       shift
  3179.       shift
  3180.  
  3181.       # Install the shared library and build the symlinks.
  3182.       $show "$install_prog $dir/$realname $destdir/$realname"
  3183.       $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  3184.       test "X$dlname" = "X$realname" && dlname=
  3185.  
  3186.       if test $# -gt 0; then
  3187.         # Delete the old symlinks, and create new ones.
  3188.         for linkname
  3189.         do
  3190.           test "X$dlname" = "X$linkname" && dlname=
  3191.           if test "$linkname" != "$realname"; then
  3192.         $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3193.         $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3194.           fi
  3195.         done
  3196.       fi
  3197.  
  3198.       if test -n "$dlname"; then
  3199.         # Install the dynamically-loadable library.
  3200.         $show "$install_prog $dir/$dlname $destdir/$dlname"
  3201.         $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
  3202.       fi
  3203.  
  3204.       # Do each command in the postinstall commands.
  3205.       lib="$destdir/$realname"
  3206.       eval cmds=\"$postinstall_cmds\"
  3207.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3208.       for cmd in $cmds; do
  3209.         IFS="$save_ifs"
  3210.         $show "$cmd"
  3211.         $run eval "$cmd" || exit $?
  3212.       done
  3213.       IFS="$save_ifs"
  3214.     fi
  3215.  
  3216.     # Install the pseudo-library for information purposes.
  3217.     name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3218.     instname="$dir/$name"i
  3219.     $show "$install_prog $instname $destdir/$name"
  3220.     $run eval "$install_prog $instname $destdir/$name" || exit $?
  3221.  
  3222.     # Maybe install the static library, too.
  3223.     test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3224.     ;;
  3225.  
  3226.       *.lo)
  3227.     # Install (i.e. copy) a libtool object.
  3228.  
  3229.     # Figure out destination file name, if it wasn't already specified.
  3230.     if test -n "$destname"; then
  3231.       destfile="$destdir/$destname"
  3232.     else
  3233.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3234.       destfile="$destdir/$destfile"
  3235.     fi
  3236.  
  3237.     # Deduce the name of the destination old-style object file.
  3238.     case "$destfile" in
  3239.     *.lo)
  3240.       staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3241.       ;;
  3242.     *.o | *.obj)
  3243.       staticdest="$destfile"
  3244.       destfile=
  3245.       ;;
  3246.     *)
  3247.       $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3248.       $echo "$help" 1>&2
  3249.       exit 1
  3250.       ;;
  3251.     esac
  3252.  
  3253.     # Install the libtool object if requested.
  3254.     if test -n "$destfile"; then
  3255.       $show "$install_prog $file $destfile"
  3256.       $run eval "$install_prog $file $destfile" || exit $?
  3257.     fi
  3258.  
  3259.     # Install the old object if enabled.
  3260.     if test "$build_old_libs" = yes; then
  3261.       # Deduce the name of the old-style object file.
  3262.       staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3263.  
  3264.       $show "$install_prog $staticobj $staticdest"
  3265.       $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3266.     fi
  3267.     exit 0
  3268.     ;;
  3269.  
  3270.       *)
  3271.     # Figure out destination file name, if it wasn't already specified.
  3272.     if test -n "$destname"; then
  3273.       destfile="$destdir/$destname"
  3274.     else
  3275.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3276.       destfile="$destdir/$destfile"
  3277.     fi
  3278.  
  3279.     # Do a test to see if this is really a libtool program.
  3280.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3281.       link_against_libtool_libs=
  3282.       relink_command=
  3283.  
  3284.       # If there is no directory component, then add one.
  3285.       case "$file" in
  3286.       */* | *\\*) . $file ;;
  3287.       *) . ./$file ;;
  3288.       esac
  3289.  
  3290.       # Check the variables that should have been set.
  3291.       if test -z "$link_against_libtool_libs"; then
  3292.         $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  3293.         exit 1
  3294.       fi
  3295.  
  3296.       finalize=yes
  3297.       for lib in $link_against_libtool_libs; do
  3298.         # Check to see that each library is installed.
  3299.         libdir=
  3300.         if test -f "$lib"; then
  3301.           # If there is no directory component, then add one.
  3302.           case "$lib" in
  3303.           */* | *\\*) . $lib ;;
  3304.           *) . ./$lib ;;
  3305.           esac
  3306.         fi
  3307.         libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  3308.         if test -n "$libdir" && test ! -f "$libfile"; then
  3309.           $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  3310.           finalize=no
  3311.         fi
  3312.       done
  3313.  
  3314.       outputname=
  3315.       if test "$fast_install" = no && test -n "$relink_command"; then
  3316.         if test "$finalize" = yes && test -z "$run"; then
  3317.           tmpdir="/tmp"
  3318.           test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3319.           tmpdir="$tmpdir/libtool-$$"
  3320.           if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3321.           else
  3322.         $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3323.         continue
  3324.           fi
  3325.           outputname="$tmpdir/$file"
  3326.           # Replace the output file specification.
  3327.           relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3328.  
  3329.           $show "$relink_command"
  3330.           if $run eval "$relink_command"; then :
  3331.           else
  3332.         $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3333.         ${rm}r "$tmpdir"
  3334.         continue
  3335.           fi
  3336.           file="$outputname"
  3337.         else
  3338.           $echo "$modename: warning: cannot relink \`$file'" 1>&2
  3339.         fi
  3340.       else
  3341.         # Install the binary that we compiled earlier.
  3342.         file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  3343.       fi
  3344.     fi
  3345.  
  3346.     $show "$install_prog$stripme $file $destfile"
  3347.     $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  3348.     test -n "$outputname" && ${rm}r "$tmpdir"
  3349.     ;;
  3350.       esac
  3351.     done
  3352.  
  3353.     for file in $staticlibs; do
  3354.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3355.  
  3356.       # Set up the ranlib parameters.
  3357.       oldlib="$destdir/$name"
  3358.  
  3359.       $show "$install_prog $file $oldlib"
  3360.       $run eval "$install_prog \$file \$oldlib" || exit $?
  3361.  
  3362.       # Do each command in the postinstall commands.
  3363.       eval cmds=\"$old_postinstall_cmds\"
  3364.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3365.       for cmd in $cmds; do
  3366.     IFS="$save_ifs"
  3367.     $show "$cmd"
  3368.     $run eval "$cmd" || exit $?
  3369.       done
  3370.       IFS="$save_ifs"
  3371.     done
  3372.  
  3373.     if test -n "$future_libdirs"; then
  3374.       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  3375.     fi
  3376.  
  3377.     if test -n "$current_libdirs"; then
  3378.       # Maybe just do a dry run.
  3379.       test -n "$run" && current_libdirs=" -n$current_libdirs"
  3380.       exec $SHELL $0 --finish$current_libdirs
  3381.       exit 1
  3382.     fi
  3383.  
  3384.     exit 0
  3385.     ;;
  3386.  
  3387.   # libtool finish mode
  3388.   finish)
  3389.     modename="$modename: finish"
  3390.     libdirs="$nonopt"
  3391.     admincmds=
  3392.  
  3393.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3394.       for dir
  3395.       do
  3396.     libdirs="$libdirs $dir"
  3397.       done
  3398.  
  3399.       for libdir in $libdirs; do
  3400.     if test -n "$finish_cmds"; then
  3401.       # Do each command in the finish commands.
  3402.       eval cmds=\"$finish_cmds\"
  3403.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3404.       for cmd in $cmds; do
  3405.         IFS="$save_ifs"
  3406.         $show "$cmd"
  3407.         $run eval "$cmd" || admincmds="$admincmds
  3408.        $cmd"
  3409.       done
  3410.       IFS="$save_ifs"
  3411.     fi
  3412.     if test -n "$finish_eval"; then
  3413.       # Do the single finish_eval.
  3414.       eval cmds=\"$finish_eval\"
  3415.       $run eval "$cmds" || admincmds="$admincmds
  3416.        $cmds"
  3417.     fi
  3418.       done
  3419.     fi
  3420.  
  3421.     # Exit here if they wanted silent mode.
  3422.     test "$show" = : && exit 0
  3423.  
  3424.     echo "----------------------------------------------------------------------"
  3425.     echo "Libraries have been installed in:"
  3426.     for libdir in $libdirs; do
  3427.       echo "   $libdir"
  3428.     done
  3429.     echo
  3430.     echo "If you ever happen to want to link against installed libraries"
  3431.     echo "in a given directory, LIBDIR, you must either use libtool, and"
  3432.     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  3433.     echo "flag during linking and do at least one of the following:"
  3434.     if test -n "$shlibpath_var"; then
  3435.       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  3436.       echo "     during execution"
  3437.     fi
  3438.     if test -n "$runpath_var"; then
  3439.       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  3440.       echo "     during linking"
  3441.     fi
  3442.     if test -n "$hardcode_libdir_flag_spec"; then
  3443.       libdir=LIBDIR
  3444.       eval flag=\"$hardcode_libdir_flag_spec\"
  3445.  
  3446.       echo "   - use the \`$flag' linker flag"
  3447.     fi
  3448.     if test -n "$admincmds"; then
  3449.       echo "   - have your system administrator run these commands:$admincmds"
  3450.     fi
  3451.     if test -f /etc/ld.so.conf; then
  3452.       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3453.     fi
  3454.     echo
  3455.     echo "See any operating system documentation about shared libraries for"
  3456.     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3457.     echo "----------------------------------------------------------------------"
  3458.     exit 0
  3459.     ;;
  3460.  
  3461.   # libtool execute mode
  3462.   execute)
  3463.     modename="$modename: execute"
  3464.  
  3465.     # The first argument is the command name.
  3466.     cmd="$nonopt"
  3467.     if test -z "$cmd"; then
  3468.       $echo "$modename: you must specify a COMMAND" 1>&2
  3469.       $echo "$help"
  3470.       exit 1
  3471.     fi
  3472.  
  3473.     # Handle -dlopen flags immediately.
  3474.     for file in $execute_dlfiles; do
  3475.       if test ! -f "$file"; then
  3476.     $echo "$modename: \`$file' is not a file" 1>&2
  3477.     $echo "$help" 1>&2
  3478.     exit 1
  3479.       fi
  3480.  
  3481.       dir=
  3482.       case "$file" in
  3483.       *.la)
  3484.     # Check to see that this really is a libtool archive.
  3485.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3486.     else
  3487.       $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3488.       $echo "$help" 1>&2
  3489.       exit 1
  3490.     fi
  3491.  
  3492.     # Read the libtool library.
  3493.     dlname=
  3494.     library_names=
  3495.  
  3496.     # If there is no directory component, then add one.
  3497.     case "$file" in
  3498.     */* | *\\*) . $file ;;
  3499.     *) . ./$file ;;
  3500.     esac
  3501.  
  3502.     # Skip this library if it cannot be dlopened.
  3503.     if test -z "$dlname"; then
  3504.       # Warn if it was a shared library.
  3505.       test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  3506.       continue
  3507.     fi
  3508.  
  3509.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3510.     test "X$dir" = "X$file" && dir=.
  3511.  
  3512.     if test -f "$dir/$objdir/$dlname"; then
  3513.       dir="$dir/$objdir"
  3514.     else
  3515.       $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  3516.       exit 1
  3517.     fi
  3518.     ;;
  3519.  
  3520.       *.lo)
  3521.     # Just add the directory containing the .lo file.
  3522.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3523.     test "X$dir" = "X$file" && dir=.
  3524.     ;;
  3525.  
  3526.       *)
  3527.     $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  3528.     continue
  3529.     ;;
  3530.       esac
  3531.  
  3532.       # Get the absolute pathname.
  3533.       absdir=`cd "$dir" && pwd`
  3534.       test -n "$absdir" && dir="$absdir"
  3535.  
  3536.       # Now add the directory to shlibpath_var.
  3537.       if eval "test -z \"\$$shlibpath_var\""; then
  3538.     eval "$shlibpath_var=\"\$dir\""
  3539.       else
  3540.     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3541.       fi
  3542.     done
  3543.  
  3544.     # This variable tells wrapper scripts just to set shlibpath_var
  3545.     # rather than running their programs.
  3546.     libtool_execute_magic="$magic"
  3547.  
  3548.     # Check if any of the arguments is a wrapper script.
  3549.     args=
  3550.     for file
  3551.     do
  3552.       case "$file" in
  3553.       -*) ;;
  3554.       *)
  3555.     # Do a test to see if this is really a libtool program.
  3556.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3557.       # If there is no directory component, then add one.
  3558.       case "$file" in
  3559.       */* | *\\*) . $file ;;
  3560.       *) . ./$file ;;
  3561.       esac
  3562.  
  3563.       # Transform arg to wrapped name.
  3564.       file="$progdir/$program"
  3565.     fi
  3566.     ;;
  3567.       esac
  3568.       # Quote arguments (to preserve shell metacharacters).
  3569.       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  3570.       args="$args \"$file\""
  3571.     done
  3572.  
  3573.     if test -z "$run"; then
  3574.       # Export the shlibpath_var.
  3575.       eval "export $shlibpath_var"
  3576.  
  3577.       # Restore saved enviroment variables
  3578.       if test "${save_LC_ALL+set}" = set; then
  3579.     LC_ALL="$save_LC_ALL"; export LC_ALL
  3580.       fi
  3581.       if test "${save_LANG+set}" = set; then
  3582.     LANG="$save_LANG"; export LANG
  3583.       fi
  3584.  
  3585.       # Now actually exec the command.
  3586.       eval "exec \$cmd$args"
  3587.  
  3588.       $echo "$modename: cannot exec \$cmd$args"
  3589.       exit 1
  3590.     else
  3591.       # Display what would be done.
  3592.       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  3593.       $echo "export $shlibpath_var"
  3594.       $echo "$cmd$args"
  3595.       exit 0
  3596.     fi
  3597.     ;;
  3598.  
  3599.   # libtool uninstall mode
  3600.   uninstall)
  3601.     modename="$modename: uninstall"
  3602.     rm="$nonopt"
  3603.     files=
  3604.  
  3605.     for arg
  3606.     do
  3607.       case "$arg" in
  3608.       -*) rm="$rm $arg" ;;
  3609.       *) files="$files $arg" ;;
  3610.       esac
  3611.     done
  3612.  
  3613.     if test -z "$rm"; then
  3614.       $echo "$modename: you must specify an RM program" 1>&2
  3615.       $echo "$help" 1>&2
  3616.       exit 1
  3617.     fi
  3618.  
  3619.     for file in $files; do
  3620.       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3621.       test "X$dir" = "X$file" && dir=.
  3622.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3623.  
  3624.       rmfiles="$file"
  3625.  
  3626.       case "$name" in
  3627.       *.la)
  3628.     # Possibly a libtool archive, so verify it.
  3629.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3630.       . $dir/$name
  3631.  
  3632.       # Delete the libtool libraries and symlinks.
  3633.       for n in $library_names; do
  3634.         rmfiles="$rmfiles $dir/$n"
  3635.         test "X$n" = "X$dlname" && dlname=
  3636.       done
  3637.       test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
  3638.       test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  3639.  
  3640.       $show "$rm $rmfiles"
  3641.       $run $rm $rmfiles
  3642.  
  3643.       if test -n "$library_names"; then
  3644.         # Do each command in the postuninstall commands.
  3645.         eval cmds=\"$postuninstall_cmds\"
  3646.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3647.         for cmd in $cmds; do
  3648.           IFS="$save_ifs"
  3649.           $show "$cmd"
  3650.           $run eval "$cmd"
  3651.         done
  3652.         IFS="$save_ifs"
  3653.       fi
  3654.  
  3655.       if test -n "$old_library"; then
  3656.         # Do each command in the old_postuninstall commands.
  3657.         eval cmds=\"$old_postuninstall_cmds\"
  3658.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3659.         for cmd in $cmds; do
  3660.           IFS="$save_ifs"
  3661.           $show "$cmd"
  3662.           $run eval "$cmd"
  3663.         done
  3664.         IFS="$save_ifs"
  3665.       fi
  3666.  
  3667.       # FIXME: should reinstall the best remaining shared library.
  3668.     fi
  3669.     ;;
  3670.  
  3671.       *.lo)
  3672.     if test "$build_old_libs" = yes; then
  3673.       oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  3674.       rmfiles="$rmfiles $dir/$oldobj"
  3675.     fi
  3676.     $show "$rm $rmfiles"
  3677.     $run $rm $rmfiles
  3678.     ;;
  3679.  
  3680.       *)
  3681.     $show "$rm $rmfiles"
  3682.     $run $rm $rmfiles
  3683.     ;;
  3684.       esac
  3685.     done
  3686.     exit 0
  3687.     ;;
  3688.  
  3689.   "")
  3690.     $echo "$modename: you must specify a MODE" 1>&2
  3691.     $echo "$generic_help" 1>&2
  3692.     exit 1
  3693.     ;;
  3694.   esac
  3695.  
  3696.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3697.   $echo "$generic_help" 1>&2
  3698.   exit 1
  3699. fi # test -z "$show_help"
  3700.  
  3701. # We need to display help for each of the modes.
  3702. case "$mode" in
  3703. "") $echo \
  3704. "Usage: $modename [OPTION]... [MODE-ARG]...
  3705.  
  3706. Provide generalized library-building support services.
  3707.  
  3708.     --config          show all configuration variables
  3709.     --debug           enable verbose shell tracing
  3710. -n, --dry-run         display commands without modifying any files
  3711.     --features        display basic configuration information and exit
  3712.     --finish          same as \`--mode=finish'
  3713.     --help            display this help message and exit
  3714.     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  3715.     --quiet           same as \`--silent'
  3716.     --silent          don't print informational messages
  3717.     --version         print version information
  3718.  
  3719. MODE must be one of the following:
  3720.  
  3721.       compile         compile a source file into a libtool object
  3722.       execute         automatically set library path, then run a program
  3723.       finish          complete the installation of libtool libraries
  3724.       install         install libraries or executables
  3725.       link            create a library or an executable
  3726.       uninstall       remove libraries from an installed directory
  3727.  
  3728. MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  3729. a more detailed description of MODE."
  3730.   exit 0
  3731.   ;;
  3732.  
  3733. compile)
  3734.   $echo \
  3735. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3736.  
  3737. Compile a source file into a libtool library object.
  3738.  
  3739. This mode accepts the following additional options:
  3740.  
  3741.   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  3742.   -static           always build a \`.o' file suitable for static linking
  3743.  
  3744. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  3745. from the given SOURCEFILE.
  3746.  
  3747. The output file name is determined by removing the directory component from
  3748. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  3749. library object suffix, \`.lo'."
  3750.   ;;
  3751.  
  3752. execute)
  3753.   $echo \
  3754. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  3755.  
  3756. Automatically set library path, then run a program.
  3757.  
  3758. This mode accepts the following additional options:
  3759.  
  3760.   -dlopen FILE      add the directory containing FILE to the library path
  3761.  
  3762. This mode sets the library path environment variable according to \`-dlopen'
  3763. flags.
  3764.  
  3765. If any of the ARGS are libtool executable wrappers, then they are translated
  3766. into their corresponding uninstalled binary, and any of their required library
  3767. directories are added to the library path.
  3768.  
  3769. Then, COMMAND is executed, with ARGS as arguments."
  3770.   ;;
  3771.  
  3772. finish)
  3773.   $echo \
  3774. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  3775.  
  3776. Complete the installation of libtool libraries.
  3777.  
  3778. Each LIBDIR is a directory that contains libtool libraries.
  3779.  
  3780. The commands that this mode executes may require superuser privileges.  Use
  3781. the \`--dry-run' option if you just want to see what would be executed."
  3782.   ;;
  3783.  
  3784. install)
  3785.   $echo \
  3786. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  3787.  
  3788. Install executables or libraries.
  3789.  
  3790. INSTALL-COMMAND is the installation command.  The first component should be
  3791. either the \`install' or \`cp' program.
  3792.  
  3793. The rest of the components are interpreted as arguments to that command (only
  3794. BSD-compatible install options are recognized)."
  3795.   ;;
  3796.  
  3797. link)
  3798.   $echo \
  3799. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  3800.  
  3801. Link object files or libraries together to form another library, or to
  3802. create an executable program.
  3803.  
  3804. LINK-COMMAND is a command using the C compiler that you would use to create
  3805. a program from several object files.
  3806.  
  3807. The following components of LINK-COMMAND are treated specially:
  3808.  
  3809.   -all-static       do not do any dynamic linking at all
  3810.   -avoid-version    do not add a version suffix if possible
  3811.   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  3812.   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  3813.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3814.   -export-symbols SYMFILE
  3815.             try to export only the symbols listed in SYMFILE
  3816.   -export-symbols-regex REGEX
  3817.             try to export only the symbols matching REGEX
  3818.   -LLIBDIR          search LIBDIR for required installed libraries
  3819.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  3820.   -module           build a library that can dlopened
  3821.   -no-undefined     declare that a library does not refer to external symbols
  3822.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  3823.   -release RELEASE  specify package release information
  3824.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  3825.   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  3826.   -static           do not do any dynamic linking of libtool libraries
  3827.   -version-info CURRENT[:REVISION[:AGE]]
  3828.             specify library version info [each variable defaults to 0]
  3829.  
  3830. All other options (arguments beginning with \`-') are ignored.
  3831.  
  3832. Every other argument is treated as a filename.  Files ending in \`.la' are
  3833. treated as uninstalled libtool libraries, other files are standard or library
  3834. object files.
  3835.  
  3836. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  3837. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  3838. required, except when creating a convenience library.
  3839.  
  3840. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  3841. using \`ar' and \`ranlib', or on Windows using \`lib'.
  3842.  
  3843. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  3844. is created, otherwise an executable program is created."
  3845.   ;;
  3846.  
  3847. uninstall)
  3848.   $echo \
  3849. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3850.  
  3851. Remove libraries from an installation directory.
  3852.  
  3853. RM is the name of the program to use to delete files associated with each FILE
  3854. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  3855. to RM.
  3856.  
  3857. If FILE is a libtool library, all the files associated with it are deleted.
  3858. Otherwise, only FILE itself is deleted using RM."
  3859.   ;;
  3860.  
  3861. *)
  3862.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3863.   $echo "$help" 1>&2
  3864.   exit 1
  3865.   ;;
  3866. esac
  3867.  
  3868. echo
  3869. $echo "Try \`$modename --help' for more information about other modes."
  3870.  
  3871. exit 0
  3872.  
  3873. # Local Variables:
  3874. # mode:shell-script
  3875. # sh-indentation:2
  3876. # End:
  3877.